SIGEVENT(3) | Library Functions Manual | SIGEVENT(3) |
Realtime functions that can generate realtime signals include:
The <sys/signal.h> header, included by <signal.h>, defines a sigevent structure, which is the cornerstone in asynchronous delivery of realtime signals. This structure is defined as:
struct sigevent { int sigev_notify; int sigev_signo; union sigval sigev_value; void (*sigev_notify_function)(union sigval); void *sigev_notify_attributes; };
The included union is further defined in <siginfo.h> as:
typedef union sigval { int sival_int; void *sival_ptr; } sigval_t;
The sigev_notify integer defines the action taken when a notification such as timer expiration occurs. The possiblue values are:
In the signal handler the ‘si_value' of siginfo_t is set to the value specified by the sigev_value. In another words, the sigev_value member is an application-defined value to be passed to a particular signal handler at the time of signal delivery. Depending whether the specified value is an integer or a pointer, the delivered value can be either sigval_intr or sigval_ptr.
If sigev_notify_attributes is not NULL, the provided attribute specifies the behavior of the thread; see pthread_attr(3). (Note that although a pointer to void is specified for sigev_notify_attributes, the type is pthread_attr_t in practice.)
The threads are created as detached, or in an unspecified way if pthread_attr_setdetachstate(3) is used with sigev_notify_attributes to set PTHREAD_CREATE_JOINABLE. It is not valid to call pthread_join(3) in either case. Hence, it is impossible to determine the lifetime of the created thread. This in turn means that it is neither possible to recover the memory nor the address of the memory possibly dedicated as thread stack via pthread_attr_setstack() or pthread_attr_setstackaddr().
June 24, 2010 | NetBSD 6.1 |