sensitivity.io for iOS & macOS  1.1.4
Instance Methods | List of all members
ThreadPool Class Reference

#import <ThreadPool.h>

Inheritance diagram for ThreadPool:

Instance Methods

(BOOL) - setMaxThreadCount:withError:
 
(BOOL) - maxThreadCount:withError:
 
(BOOL) - timedWait:forDone:withError:
 
(BOOL) - waitForDoneWithError:
 
(BOOL) - activeThreadCount:withError:
 
(BOOL) - setExpiryTimeout:withError:
 
(BOOL) - expiryTimeout:withError:
 

Detailed Description

The thread pool where all module task executor threads exist.

Note
You can not initialize this class directly. Use the specific module executor class instead to retrieve it's thread pool.

Method Documentation

◆ activeThreadCount:withError:()

- (BOOL) activeThreadCount: (NSUInteger *_Nonnull)  activeThreadCount
withError: (NSError *_Nullable *_Nullable)  error 

Get the number of active threads in the thread pool.

Parameters
activeThreadCountWill be set to the number of active threads in the threadpool
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ expiryTimeout:withError:()

- (BOOL) expiryTimeout: (NSInteger *_Nonnull)  expiryTimeout
withError: (NSError *_Nullable *_Nullable)  error 

Gets the expiry timeout

Parameters
expiryTimeoutWill be set to the existing expiry timeout
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ maxThreadCount:withError:()

- (BOOL) maxThreadCount: (NSUInteger *_Nonnull)  maxThreadCount
withError: (NSError *_Nullable *_Nullable)  error 

Gets maximum number of threads used by the thread pool

Parameters
maxThreadCountWill be set to the maximum number of threads used by the thread pool
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ setExpiryTimeout:withError:()

- (BOOL) setExpiryTimeout: (NSInteger)  expiryTimeout
withError: (NSError *_Nullable *_Nullable)  error 

Threads that are unused for expiryTimeout milliseconds are considered to have expired and will exit. Such threads will be restarted as needed. The default expiryTimeout is 30000 milliseconds. If expiryTimeout is negative, newly created threads will not expire (they will not exit until the thread pool is destroyed).

Note
expiryTimeout has no effect on already running threads (only on newly created threads).
Parameters
expiryTimeoutThe expiryTimeout to set
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ setMaxThreadCount:withError:()

- (BOOL) setMaxThreadCount: (NSUInteger)  maxThreadCount
withError: (NSError *_Nullable *_Nullable)  error 

Set maximum number of threads used by the thread pool.

Precondition
maxThreadCount >= 1
Parameters
maxThreadCountmaximum number of threads
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ timedWait:forDone:withError:()

- (BOOL) timedWait: (NSUInteger)  msecs
forDone: (BOOL *_Nonnull)  done
withError: (NSError *_Nullable *_Nullable)  error 

Waits up to msecs milliseconds for all threads to exit and removes all threads from the thread pool.

Precondition
msecs >= 0
Parameters
msecsThe milliseconds to wait for all threads to be finished
doneWill be set to true if threadpool is finished, false otherwise
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

◆ waitForDoneWithError:()

- (BOOL) waitForDoneWithError: (NSError *_Nullable *_Nullable)  error

Waits untill all threads exit and are removed from the thread pool.

Parameters
errorThe error representing the reason for the failure
Returns
True on success, false in case an error occured

The documentation for this class was generated from the following file: