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/m/message_detach.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/m/message_detach.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/m/message_detach.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/m/message_detach.html on line 8

message_detach()

Detach a message range

Synopsis:

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

int message_detach( dispatch_t * dpp,
                    int low,
                    int high,
                    int flags );

Arguments:

dpp
The dispatch handle, as returned by dispatch_create().
low, high
The range of messages that you want to detach the handler from. This range must be the same one that you passed to message_attach().
flags
Reserved.

Library:

libc

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

Description:

The message_detach() function detaches the message type [low, high], for dispatch handle dpp, that was attached with message_attach().

Returns:

Zero on success. If an error occurs, -1 or the following error constant:

EINVAL
The range [low, high] doesn't match the range that you attached with message_attach().

Examples:

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

int my_func( … ) {

   …

}
        
int main( int argc, char **argv ) {
   dispatch_t    *dpp;
   int           lo=0x2000, hi=0x2fff, flags=0;
    
   if( ( dpp = dispatch_create() ) == NULL ) {
     fprintf( stderr, 
       "%s: Unable to allocate dispatch handle.\n",
       argv[0] );
     return EXIT_FAILURE;
   }

   …

   if( message_attach( dpp, NULL, lo, hi,
                       &my_func, NULL) == -1 ) {
     fprintf( stderr, 
       "%s: Failed to attach message range.\n",
        argv[0] );
     return 1;
   }
    
   …

   if ( message_detach ( dpp, lo, hi, flags ) == -1 ) {
      fprintf ( stderr, 
        "Failed to detach message range from %d to %d.\n",
        lo, hi );
      return 1;
   }
   /* else message was detached */
            
   …
}

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:

message_attach()

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/m/message_detach.html on line 192

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/m/message_detach.html on line 192