|
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 193 of file WaitQueue.cc.
| WaitQueue::~WaitQueue | ( | ) |
Definition at line 200 of file WaitQueue.cc.
|
inline |
Definition at line 139 of file WaitQueue.h.
|
private |
Definition at line 508 of file WaitQueue.cc.
|
private |
Definition at line 355 of file WaitQueue.cc.
Definition at line 434 of file WaitQueue.cc.
|
staticprivate |
Definition at line 461 of file WaitQueue.cc.
|
private |
Definition at line 480 of file WaitQueue.cc.
|
private |
Definition at line 206 of file WaitQueue.cc.
| size_t WaitQueue::waiterCount | ( | ) |
Definition at line 556 of file WaitQueue.cc.
| size_t WaitQueue::wakeAll | ( | WakeReason | reason = WakeReason::Signalled, |
| const Channel & | channel = Channel() |
||
| ) |
Definition at line 340 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 345 of file WaitQueue.cc.
References ProcessorBase::guardDeviceHardIrqOperation().
Referenced by Cache::read(), and Semaphore::release().
Here is the caller graph for this function:
|
private |
Definition at line 379 of file WaitQueue.cc.
|
private |
Definition at line 396 of file WaitQueue.cc.
| bool WaitQueue::wakeOne | ( | WakeReason | reason = WakeReason::Signalled, |
| const Channel & | channel = Channel() |
||
| ) |
Definition at line 335 of file WaitQueue.cc.
Definition at line 363 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.