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/d/dispatch_timeout.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/d/dispatch_timeout.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/d/dispatch_timeout.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/d/dispatch_timeout.html on line 8

dispatch_timeout()

Set a timeout

Synopsis:

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

int dispatch_timeout( dispatch_t *dpp,
                      struct timespec *reltime );

Arguments:

dpp
A dispatch handle created by dispatch_create().
reltime
A pointer to a timespec structure that specifies the relative time of the timeout.

Library:

libc

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

Description:

The function dispatch_timeout() sets a timeout that's used when blocking with dispatch_block().

This function is part of the dispatch layer of a resource manager. For more information, see Layers in a resource manager in the Bones of a Resource Manager chapter of Writing a Resource Manager.

Returns:

0
Success.
-1
An error occurred.

Examples:

#include <sys/dispatch.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
    
int main( int argc, char **argv ) {
   dispatch_t           *dpp;
   struct timespec      time_out;
   int                  timedout;
   time_out.tv_sec = 1;
   time_out.tv_nsec = 2;

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

   if ( (timedout = dispatch_timeout ( dpp, &time_out ))
         == -1 ) {
       fprintf ( stderr, "Couldn't set timeout );
       return EXIT_FAILURE;
   }
   /* else successful timeout set */

   …
   return EXIT_SUCCESS;
}

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

Classification:

QNX Neutrino

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

See also:

dispatch_block(), dispatch_create(), dispatch_create_channel(), dispatch_handler(), dispatch_unblock() timespec

Layers in a resource manager in the Bones of a Resource Manager chapter of Writing a Resource Manager


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/d/dispatch_timeout.html on line 180

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/d/dispatch_timeout.html on line 180