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/r/resmgr_block.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/r/resmgr_block.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/r/resmgr_block.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/r/resmgr_block.html on line 8
Block while waiting for a message
#include <sys/iofunc.h>
#include <sys/dispatch.h>
resmgr_context_t * resmgr_block
( resmgr_context_t * ctp );
- ctp
- A pointer to a
resmgr_context_t
structure that the resource-manager library uses to pass context information
between functions.
libc
Use the -l c option to
qcc
to link against this library.
This library is usually included automatically.
The resmgr_block() function waits for a message (created by a call to
resmgr_context_alloc())
for context ctp.
|
This function is a special case of
dispatch_block()
that you should use only with a simple resource manager.
If you need to attach pulses or other messages,
then you should use dispatch_block(). |
The same pointer as ctp,
or NULL if an error occurs
(errno is set).
- EFAULT
- A fault occurred when the kernel tried to access the buffers provided.
Because the OS accesses the sender's buffers only when
MsgReceive() is called,
a fault could occur in the sender if the sender's buffers are invalid.
If a fault occurs when accessing the sender buffers
(only) they'll receive an EFAULT and the
MsgReceive() won't unblock.
- EINTR
- The call was interrupted by a signal.
- ETIMEDOUT
- A kernel timeout (that was set with
dispatch_timeout())
unblocked the call.
#include <sys/dispatch.h>
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv ) {
dispatch_t *dpp;
resmgr_context_t *ctp;
if ((dpp = dispatch_create()) == NULL) {
fprintf( stderr, "%s: Unable to allocate \
dispatch handle.\n",argv[0] );
return EXIT_FAILURE;
}
…
ctp = resmgr_context_alloc( dpp );
while (1) {
if ( ( ctp = resmgr_block( ctp )) == NULL ) {
fprintf( stderr, "block error\n" );
return EXIT_FAILURE;
}
resmgr_handler( ctp );
}
}
For examples using the dispatch interface, see
dispatch_create(),
message_attach(),
resmgr_attach(), and
thread_pool_create().
QNX Neutrino
Safety: | |
Cancellation point |
Yes |
Interrupt handler |
No |
Signal handler |
No |
Thread |
Yes |
Use resmgr_block() only in a simple resource manager and when you don't use
message_attach(),
pulse_attach(), or
select_attach().
dispatch_block(),
resmgr_attach(),
resmgr_context_alloc(),
resmgr_handler()
“Layers in a resource manager”
in the Bones of a Resource Manager chapter of Writing a Resource Manager
Resource Managers
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/r/resmgr_block.html on line 213
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/r/resmgr_block.html on line 213