Return a pointer to a singleton workforce thrGetWorkforce
One the first invocation, this function invokes thrCreateWorkforce to create a new workforce with the requested number of threads. A pointer to this workforce is stored internally, and the same pointer is returned on each subsequent invocation of this function.
If the returned workforce is freed explicitly using thrDestroyWorkforce, then the next invocation of this function will create a new workforce again. For this reason, applications should not normally free the returned workforce explicitly. The resources associated with the workforce will be freed when the monolith process terminates.
"
nworker"
is zero, a NULL
pointer is always returned (in which case the app should be run in a single thread without any
workers). If "
nworker"
is positive, it will be ignored if a workforce already exists, and will be
used to specify the number of worker threads in the new workforce otherwise.