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

message_connect()

Create a connection to a channel

Synopsis:

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

int message_connect( dispatch_t * dpp,
                     int flags );

Arguments:

dpp
The dispatch handle, as returned by dispatch_create().
flags
Currently, the following flag is defined in <sys/dispatch.h>:

Library:

libc

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

Description:

The message_connect() function creates a connection to the channel used by dispatch handle dpp. This function calls the ConnectAttach() kernel call. To detach the connection ID, you can call ConnectDetach().


Note: The message_connect() function works only when the dispatch blocking type is receive, i.e. attaches were done for resmgr, message, or select “type” events. If no attaches were done yet, the message_connect() call fails, since dispatch can't determine if receive or sigwait blocking will be used.

Returns:

A connection ID used by the message primitives, or -1 if an error occurs (errno is set).

Errors:

EAGAIN
All kernel connection objects are in use.
EINVAL
Dispatch dpp doesn't have a channel.

Examples:

#include <sys/dispatch.h>
#include <time.h>
#include <stdio.h>
#include <stdlib.h>
        
int main( int argc, char **argv ) {
   dispatch_t    *dpp;
   int           flags, coid, id;
    
   if( ( dpp = dispatch_create() ) == NULL ) {
     fprintf( stderr, 
        "%s: Unable to allocate dispatch context.\n",
        argv[0] );
     return EXIT_FAILURE;
   }

   id = resmgr_attach ( … );
    
   …

   if ( (coid = message_connect ( dpp, flags )) == -1 ) {
      fprintf ( stderr, "Failed to create connection \
                to channel used by dispatch.\n");
      return 1;
   }
   /* else connection to channel used by dispatch is created */
            
   …
}

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

Caveats:

Dispatch dpp must block on messages.

See also:

ConnectAttach(), 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_connect.html on line 211

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_connect.html on line 211