Warning: main(/www/www/htdocs/style/globals.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/thread_pool_destroy.html on line 1

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/globals.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/thread_pool_destroy.html on line 1

Warning: main(/www/www/htdocs/style/header.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/thread_pool_destroy.html on line 8

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/header.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/thread_pool_destroy.html on line 8

thread_pool_destroy()

Free the memory allocated to a thread pool

Synopsis:

#include <sys/iofunc.h>
#include <sys/dispatch.h>

int thread_pool_destroy( thread_pool_t * pool );

Arguments:

pool
A thread pool handle that was returned by thread_pool_create().

Library:

libc

Use the -l c option to qcc to link against this library. This library is usually included automatically.

Description:

The thread_pool_destroy() function frees the memory allocated to a thread pool that's identified by the handle pool. This is done only after all the threads of the thread pool have exited.


Note: Prior to QNX Neutrino 6.1.0, this function simply deallocated the thread pool handle and returned. Although this was acceptable for servers that never exited (and consequently never shut down their thread pools), it's unsuitable for closing down a thread pool.

The thread_pool_destroy() function calls the unblock handler provided in the pool attribute structure. The unblock handler is called at least once for every thread in the thread pool. Once the unblock handler is called, the thread calling thread_pool_destroy() blocks until the number of threads in the thread pool drops to zero. When there are no more threads in the thread pool, the handle pool is freed and thread_pool_destroy() returns.


Note: A side effect of this behavior is that a thread that's created by the thread pool can't call thread_pool_destroy() because the thread pool count will never drop to zero, and subsequently the function will never return.

Returns:

0
Success.
-1
An error occurred.

Examples:

#include <sys/dispatch.h>
#include <stdio.h>

int main( int argc, char **argv ) {
   thread_pool_t        *tpp;

   …

   thread_pool_destroy ( tpp );
}

For examples using the dispatch interface, see dispatch_create(), message_attach(), resmgr_attach(), and thread_pool_create().

Classification:

QNX Neutrino

Safety:
Cancellation point Yes
Interrupt handler No
Signal handler No
Thread Yes

See also:

thread_pool_control(), thread_pool_create(), thread_pool_limits(), thread_pool_start()

Processes and Threads chapter of Getting Started with QNX Neutrino


Warning: main(/www/www/htdocs/style/footer.php) [function.main]: failed to open stream: No such file or directory in /www/www/docs/6.4.1/neutrino/lib_ref/t/thread_pool_destroy.html on line 183

Warning: main() [function.include]: Failed opening '/www/www/htdocs/style/footer.php' for inclusion (include_path='.:/www/www/common:/www/www/php/lib/php') in /www/www/docs/6.4.1/neutrino/lib_ref/t/thread_pool_destroy.html on line 183