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_start.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_start.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_start.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_start.html on line 8

thread_pool_start()

Start a thread pool

Synopsis:

#include <sys/dispatch.h>

int thread_pool_start( void *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_start() function starts the thread pool pool. The function may or may not return, depending on the flags that you passed to thread_pool_create().

Returns:

EOK
Success.
-1
An error occurred.

Examples:

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

int main( int argc, char **argv ) {
   thread_pool_attr_t   pool_attr;
   thread_pool_t        *tpp;
   dispatch_t           *dpp;
   resmgr_attr_t        attr;
   resmgr_context_t     *ctp;

   if( (dpp = dispatch_create()) == NULL ) {
     fprintf( stderr, "%s: Unable to allocate \
              dispatch context.\n", argv[0] );
     return EXIT_FAILURE;
   }

   memset( &pool_attr, 0, sizeof (pool_attr) );
   pool_attr.handle = dpp; 
   pool_attr.context_alloc = dispatch_context_alloc; 
   pool_attr.block_func = dispatch_block; 
   pool_attr.unblock_func = dispatch_unblock; 
   pool_attr.handler_func = dispatch_handler; 
   pool_attr.context_free = dispatch_context_free;
   pool_attr.lo_water = 2;
   pool_attr.hi_water = 4;
   pool_attr.increment = 1;
   pool_attr.maximum = 50;

   if( (tpp = thread_pool_create( &pool_attr,
              POOL_FLAG_EXIT_SELF )) == NULL ) {
     fprintf( stderr, "%s: Unable to initialize \
              thread pool.\n", argv[0] );
     return EXIT_FAILURE;
   }

   …

   /* Never returns */
   thread_pool_start( 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_create(), thread_pool_destroy()

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_start.html on line 174

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_start.html on line 174