Condition variable to synchronize high level communication between processing threads
First Claim
Patent Images
1. A computer system, comprising:
- a semaphore that blocks processing of a thread, the thread waiting until one of a signal issued from another thread or a time-out condition occurs;
a wait counter that counts a number of waited threads;
means for waking up a waited thread based on a time-out condition of the waited thread and for decrementing the wait counter;
a signal counter that counts a signaled number of waited threads to be woken up in response to a wake up signal;
means for waking up the signaled number of waited threads based on no antecedence and for decrementing the wait counter and the signal counter;
means for mutually locking the thread from access to the wait counter and the signal counter;
means for determining if the signaled number exceeds zero and the waited number is zero; and
means for adjusting semaphore status by generating a number of dummy waited threads equal to the signaled number when the signaled number exceeds zero and the waited number is zero.
3 Assignments
0 Petitions
Accused Products
Abstract
The method and apparatus of this invention provide a condition variable that has a time-out capability for an operating system that does not have one. A condition variable allows concurrent programming and provides high level communication between threads. The condition variable allows threads to wait within a mutex and allows broadcast signals to wake up waited threads. The condition variable is implemented by using counters to count the number of waited threads, the number of signals being sent to the waited threads, and semaphore, and means for mutually locking the thread to access the counters.
69 Citations
5 Claims
-
1. A computer system, comprising:
-
a semaphore that blocks processing of a thread, the thread waiting until one of a signal issued from another thread or a time-out condition occurs; a wait counter that counts a number of waited threads; means for waking up a waited thread based on a time-out condition of the waited thread and for decrementing the wait counter; a signal counter that counts a signaled number of waited threads to be woken up in response to a wake up signal; means for waking up the signaled number of waited threads based on no antecedence and for decrementing the wait counter and the signal counter; means for mutually locking the thread from access to the wait counter and the signal counter; means for determining if the signaled number exceeds zero and the waited number is zero; and means for adjusting semaphore status by generating a number of dummy waited threads equal to the signaled number when the signaled number exceeds zero and the waited number is zero. - View Dependent Claims (2, 3, 4, 5)
-
Specification