Remove a pathname from the pathname space
#include <sys/iofunc.h>
#include <sys/dispatch.h>
int resmgr_detach( dispatch_t * dpp,
int id,
unsigned flags );
int resmgr_detach_ctp( const dispatch_t *dpp,
resmgr_context_t *ctp,
const int id,
const unsigned flags );
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The resmgr_detach() and resmgr_detach_ctp() functions remove the pathname indicated by id from the pathname space of context dpp. The resmgr_detach_ctp() function includes a pointer to the resmgr_context_t structure, which lets the function get information about the link currently being operated on. This latter function can be used only if the _RESMGR_FLAG_DETACH_CTP flag was passed in to resmgr_attach().
Blocking states
These functions block until the RESMGR_HANDLE_T that was passed to the corresponding resmgr_attach() isn't being used in any connection function.
The effect that this has on servers is generally minimal. You should follow the following precautions to prevent potential deadlock situations:
#include <sys/dispatch.h>
#include <stdio.h>
#include <stdlib.h>
int main( int argc, char **argv ) {
dispatch_t *dpp;
int id;
if ( (dpp = dispatch_create()) == NULL ) {
fprintf( stderr, "%s: Unable to allocate \
dispatch handle.\n",argv[0] );
return EXIT_FAILURE;
}
id = resmgr_attach ( … );
…
if ( resmgr_detach( dpp, id, 0) == -1 ) {
fprintf( stderr, "Failed to remove pathname \
from the pathname space.\n" );
return EXIT_FAILURE;
}
For examples using the dispatch interface, see dispatch_create(), message_attach(), resmgr_attach(), and thread_pool_create().
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |