[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]


pthread_cond_sig_preempt_int_ np

Wakes one thread that is waiting on a condition variable. This routine can only be called from interrupt level.

Syntax

pthread_cond_sig_preempt_int_np (condition)

pthread_cond_sig_preempt_int_np (condition, scp)
 


Argument Data Type Access

cond opaque pthread_cond_t read scp opaque pthread_addr_t read


C Binding

void
pthread_cond_sig_preempt_int_np (
pthread_cond_t *condition); void
pthread_cond_sig_preempt_int_np (
pthread_cond_t *condition pthread_addr_t scp);

Arguments

cond
Condition variable signaled.
scp
UNIX signal control block pointer (this is passed as a parameter to a UNIX signal handler routine).

Description

This routine wakes one thread waiting on a condition variable. It can only be called from a software interrupt handler routine. Calling this routine implies that it might be possible for a single waiting thread to proceed. Call this routine when any thread waiting on the specified condition variable might find its predicate true.

The scheduling policies of the waiting threads determine which thread is awakened. For policies SCHED_FIFO and SCHED_RR, a blocked thread is chosen in priority order, using first-in/first-out (FIFO) within priorities.

You can call this routine when the associated mutex is either locked or unlocked. (Never try to lock a mutex from an interrupt handler.)


Note
If the waiting thread has a preemptive scheduling policy and a higher priority than the thread that was running when the interrupt occurred, then the waiting thread will preempt the interrupt routine and begin to run immediately. This is unlike pthread_cond_signal_int_np which causes the condition variable to be signalled at a safe point after the interrupt has completed. pthread_cond_sig_preempt_int_ np avoids the possible latency that pthread_cond_signal_int_np may introduce; however, a side effect of this is that during the call to pthread_cond_sig_preempt_int_np other threads may run if a preemption occurs; thus, once an interrupt routine calls pthread_ cond_sig_preempt_int_np it can no longer rely on any assumptions of exclusivity or atomicity which are typically provided by interrupt routines. Furthermore, once the call to pthread_cond_sig_preempt_ int_np is made, in addition to other threads running, subsequent interrupts may be delivered at any time as well (that is, they will not be blocked until the current interrupt completes). For this reason, it is recommended that pthread_cond_sig_preempt_int_np be called as the last statement in the interrupt routine.


Note
This routine allows you to signal a thread from a software interrupt handler. Do not call this routine from noninterrupt code. If you want to signal a thread from the normal noninterrupt level, use pthread_cond_signal.

Return Values

If an error condition occurs, this routine returns -1 and sets errno to the corresponding error value. Possible return values are as follows:
Return  Error         Description

0 Successful completion. -1 [EINVAL] The value specified by cond is invalid.



[Return to Bookshelf] [Contents] [Previous Section] [Next Section] [Index] [Help]