DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH PRINT BOOK
 
Threads

Timers

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(S), getitimer(S), setitimer and sleep(S). 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(S) 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.


Next topic: Debugging multithreaded programs
Previous topic: System call wrappers

© 2005 The SCO Group, Inc. All rights reserved.
SCO OpenServer Release 6.0.0 -- 02 June 2005