![]() |
![]() |
![]() |
![]() |
![]() |
This version of this document is no longer maintained. For the latest documentation, see http://www.qnx.com/developers/docs. |
Attach a file descriptor to a dispatch handle
#include <sys/iofunc.h>
#include <sys/dispatch.h>
int select_attach
( void *dpp,
select_attr_t *attr,
int fd,
unsigned flags,
int (*func)( select_context_t *ctp,
int fd,
unsigned flags,
void *handle ),
void *handle );
typedef struct _select_attr {
unsigned flags;
} select_attr_t;
Currently, no attribute flags are defined.
libc
Use the -l c option to qcc to link against this library. This library is usually included automatically.
The function select_attach() attaches the file descriptor fd to the dispatch handle dpp and selects flags events. When fd "unblocks", func is called with handle.
The available flags are defined in <sys/dispatch.h>. The following flags use ionotify() mechanisms (see ionotify() for further details):
These flags are specific to dispatch:
The argument func is the user-supplied function that's called when one of the registered events occurs on fd. This function should return 0 (zero); other values are reserved. The function is passed the following arguments:
For descriptions of the flags passed to func, see "Flags," above.
Zero on success, or -1 if an error occurred (errno is set).
For an example with select_attach(), see dispatch_create(). For other examples using the dispatch interface, see message_attach(), resmgr_attach(), and thread_pool_create().
| Safety: | |
|---|---|
| Cancellation point | Yes |
| Interrupt handler | No |
| Signal handler | No |
| Thread | Yes |
select_detach(), select_query()
![]() |
![]() |
![]() |
![]() |