|
The Pedigree Project 0.1
|
#include <WaitQueue.h>
Collaboration diagram for WaitQueue:Classes | |
| struct | Channel |
| class | Guard |
| struct | Waiter |
Public Types | |
| enum class | WakeReason { Waiting , Signalled , Event , Unwinding , Terminating , Spurious } |
| using | StackDiscardCleanup = void(*)(void *) |
| using | AbandonCallback = StackDiscardCleanup |
Public Member Functions | |
| MUST_USE_RESULT Guard | acquire () |
| bool | wakeOne (WakeReason reason=WakeReason::Signalled, const Channel &channel=Channel()) |
| size_t | wakeAll (WakeReason reason=WakeReason::Signalled, const Channel &channel=Channel()) |
| size_t | wakeAllIfWaiting (WakeReason reason=WakeReason::Signalled, const Channel &channel=Channel()) |
| size_t | waiterCount () |
Private Member Functions | |
| WakeReason | wait (Guard &guard, Mutex *mutex, const Channel &channel, size_t debugState, uintptr_t debugAddress, bool deferTerminal, bool dispatchEvents) |
| bool | wakeOneLocked (Guard &guard, WakeReason reason, const Channel &channel) |
| size_t | wakeAllLocked (Guard &guard, WakeReason reason, const Channel &channel) |
| size_t | wakeAndRequeueLocked (Guard &guard, const Channel &source, size_t wakeCount, const Channel &destination, size_t requeueCount) |
| bool | completeWaiter (Guard &guard, Waiter *waiter, WakeReason reason) |
| void | removeWaiterLocked (Waiter *waiter) |
| void | clearWaitIntentIfEmpty () |
| void | cancel (Waiter *waiter, WakeReason reason) |
Static Private Member Functions | |
| static void | publishReady (Waiter *waiter) |
Private Attributes | |
| Spinlock | m_Lock |
| Waiter * | m_pFirstWaiter |
| Waiter * | m_pLastWaiter |
| size_t | m_WaiterCount |
| bool | m_WaitIntent |
Friends | |
| class | Thread |
Owns the complete transition between testing a wait predicate and blocking.
A Guard serialises the predicate with wakeOne/wakeAll. wait() consumes the Guard and installs a persistent wait record before releasing the queue lock. Consequently, a wake arriving before the scheduler commits Sleeping is retained and causes the scheduler to abort the sleep.
Definition at line 28 of file WaitQueue.h.
| using WaitQueue::AbandonCallback = StackDiscardCleanup |
Definition at line 34 of file WaitQueue.h.
| using WaitQueue::StackDiscardCleanup = void (*)(void*) |
Definition at line 33 of file WaitQueue.h.
|
strong |
Definition at line 36 of file WaitQueue.h.
| WaitQueue::WaitQueue | ( | ) |
Definition at line 192 of file WaitQueue.cc.
| WaitQueue::~WaitQueue | ( | ) |
Definition at line 199 of file WaitQueue.cc.
|
inline |
Definition at line 139 of file WaitQueue.h.
|
private |
Definition at line 501 of file WaitQueue.cc.
|
private |
Definition at line 353 of file WaitQueue.cc.
Definition at line 431 of file WaitQueue.cc.
|
staticprivate |
Definition at line 455 of file WaitQueue.cc.
|
private |
Definition at line 474 of file WaitQueue.cc.
|
private |
Definition at line 205 of file WaitQueue.cc.
| size_t WaitQueue::waiterCount | ( | ) |
Definition at line 548 of file WaitQueue.cc.
| size_t WaitQueue::wakeAll | ( | WakeReason | reason = WakeReason::Signalled, |
| const Channel & | channel = Channel() |
||
| ) |
Definition at line 338 of file WaitQueue.cc.
| size_t WaitQueue::wakeAllIfWaiting | ( | WakeReason | reason = WakeReason::Signalled, |
| const Channel & | channel = Channel() |
||
| ) |
Skips an empty queue. Every matching waiter must use prepareToWait(), and the caller must publish its predicate with sequential consistency before calling this method. Ordinary wakeAll has no such requirement.
Definition at line 343 of file WaitQueue.cc.
References ProcessorBase::guardDeviceHardIrqOperation().
Referenced by Semaphore::release().
Here is the caller graph for this function:
|
private |
Definition at line 377 of file WaitQueue.cc.
|
private |
Definition at line 394 of file WaitQueue.cc.
| bool WaitQueue::wakeOne | ( | WakeReason | reason = WakeReason::Signalled, |
| const Channel & | channel = Channel() |
||
| ) |
Definition at line 333 of file WaitQueue.cc.
Definition at line 361 of file WaitQueue.cc.
|
friend |
Definition at line 169 of file WaitQueue.h.
|
private |
Definition at line 243 of file WaitQueue.h.
|
private |
Definition at line 244 of file WaitQueue.h.
|
private |
Definition at line 245 of file WaitQueue.h.
|
private |
Definition at line 246 of file WaitQueue.h.
|
private |
Definition at line 247 of file WaitQueue.h.