|
|
The Threads Library provides facilities that allow multiplexed threads to use alarms and real interval timers without requiring that the threads tie up LWPs between the initiation and expiration of the call. For this purpose, the Threads Library supplies wrappers for alarm(2), getitimer(3C), setitimer and sleep(3C). When a bound thread calls one of these routines, it has access to the full functionality as described on the reference manual page. However, when a multiplexed thread calls one of these functions, it will use the Threads Library version of the function, and in some cases the functionality will be limited. For example, a multiplexed thread can only use real timers, not virtual or profiling timers.
In addition, the wrapper versions of these functions have per-thread semantics rather than per-LWP semantics. For example, alarm(2) sets an alarm clock. When the set time expires, the caller receives a SIGALRM signal. The wrapper function ensures that the SIGALRM is delivered to the calling thread (rather than the calling LWP), regardless of whether the calling thread is running on the same LWP on which it was running when it issued the call to alarm.