|
The Pedigree Project 0.1
|
#include <OperationBarrier.h>
Collaboration diagram for OperationBarrier:Classes | |
| class | Lease |
Public Member Functions | |
| MUST_USE_RESULT bool | tryEnter () |
| MUST_USE_RESULT bool | tryAcquire (Lease &lease) |
| void | leave () |
| void | close () |
| MUST_USE_RESULT bool | tryCloseIfIdle () |
| void | wait () |
| void | closeAndWait () |
| bool | isOpen () |
| bool | isClosedAndDrained () |
Private Member Functions | |
| NOT_COPYABLE_OR_ASSIGNABLE (OperationBarrier) | |
Private Attributes | |
| WaitQueue | m_Waiters |
| bool | m_Open |
| size_t | m_ActiveOperations |
Closes admission to asynchronous work and drains work already admitted.
tryEnter() is safe in non-sleeping contexts. Every successful admission must have exactly one matching leave() after its final owner has stopped touching the protected object. Teardown closes admission before waiting, so late work is rejected without racing the final active operation.
Definition at line 23 of file OperationBarrier.h.
| OperationBarrier::OperationBarrier | ( | ) |
Definition at line 44 of file OperationBarrier.cc.
| OperationBarrier::~OperationBarrier | ( | ) |
Definition at line 46 of file OperationBarrier.cc.
| void OperationBarrier::close | ( | ) |
Rejects future admissions without waiting for existing work.
Definition at line 84 of file OperationBarrier.cc.
Referenced by closeAndWait(), NetworkStack::deRegisterDevice(), UnixSocketSyscalls::lastDescriptorClosed(), and VFS::retireOwnedFilesystem().
Here is the caller graph for this function:| void OperationBarrier::closeAndWait | ( | ) |
Atomically closes admission and waits for admitted work.
Definition at line 116 of file OperationBarrier.cc.
References close(), and wait().
Referenced by Process::closeDeferredTimeAccounting(), NetworkSyscalls::lastDescriptorClosed(), LwipSocketSyscalls::lastDescriptorClosed(), MqueueNetlinkSocket::lastDescriptorClosed(), ScsiController::shutdownDiskCaches(), and Process::~Process().
Here is the caller graph for this function:| bool OperationBarrier::isClosedAndDrained | ( | ) |
Definition at line 126 of file OperationBarrier.cc.
| bool OperationBarrier::isOpen | ( | ) |
Definition at line 121 of file OperationBarrier.cc.
| void OperationBarrier::leave | ( | ) |
Completes one successfully admitted operation.
Definition at line 73 of file OperationBarrier.cc.
References panic().
Referenced by Uhci::cancelInterruptInAndDrain(), and Ohci::retireEDStorage().
Here is the caller graph for this function:| bool OperationBarrier::tryAcquire | ( | Lease & | lease | ) |
Attempts one scope-bound admission without blocking.
The scalar/out shape is stable across the native hosted kernel and Pedigree module compilers.
Definition at line 63 of file OperationBarrier.cc.
References tryEnter().
Referenced by NetworkStack::acquireDevice(), NetworkStack::acquireDevice(), Xhci::addInterruptInHandler(), Ehci::addInterruptInHandler(), Uhci::addInterruptInHandler(), Ehci::addTransferToTransaction(), Ohci::addTransferToTransaction(), Uhci::addTransferToTransaction(), Xhci::addTransferToTransaction(), Ehci::cancelAsyncAndDrain(), Ohci::cancelAsyncAndDrain(), Uhci::cancelAsyncAndDrain(), Xhci::cancelAsyncAndDrain(), Xhci::cancelInterruptInAndDrain(), Ehci::cancelInterruptInAndDrain(), Uhci::cancelInterruptInAndDrain(), VmwareGraphics::VmwareFramebuffer::copy(), Xhci::createTransaction(), Ehci::createTransaction(), Ohci::createTransaction(), Uhci::createTransaction(), Ehci::doAsync(), Ohci::doAsync(), Xhci::doAsync(), UsbPnP::doProbe(), Process::drainDeferredTimeAccounting(), VmwareGraphics::VmwareFramebuffer::hwRedraw(), Ohci::irq(), Uhci::irq(), AdmittedThread::launchDetached(), Cache::lookupStable(), LwipSocketSyscalls::netconnCallback(), Cache::prepareDiscardFrom(), LwipSocketSyscalls::queryReady(), LwipSocketSyscalls::readinessGenerations(), Dm9601::send(), PartitionService::serve(), and Uhci::timer().
Here is the caller graph for this function:| bool OperationBarrier::tryCloseIfIdle | ( | ) |
Closes only when idle; a busy result leaves admission unchanged.
Definition at line 89 of file OperationBarrier.cc.
| bool OperationBarrier::tryEnter | ( | ) |
Attempts to admit one operation without blocking.
Definition at line 53 of file OperationBarrier.cc.
Referenced by Uhci::cancelAsyncAndDrain(), Ohci::doAsync(), Uhci::irq(), and tryAcquire().
Here is the caller graph for this function:| void OperationBarrier::wait | ( | ) |
Waits for admitted work after close() has been called.
Definition at line 98 of file OperationBarrier.cc.
References panic().
Referenced by closeAndWait(), and NetworkStack::deRegisterDevice().
Here is the caller graph for this function:
|
private |
Definition at line 87 of file OperationBarrier.h.
|
private |
Definition at line 86 of file OperationBarrier.h.
|
private |
Definition at line 85 of file OperationBarrier.h.