Module vibe.core.sync
Event loop compatible task synchronization facilities.
This module provides replacement primitives for the modules in core
that do not block vibe.d's event loop in their wait states. These should
always be preferred over the ones in Druntime under usual circumstances.
Using a standard Mutex
is possible as long as it is ensured that no event
loop based functionality (I/O, task interaction or anything that implicitly
calls yield
) is executed within a section of code that is
protected by the mutex. Failure to do so may result in dead-locks and
high-level race-conditions!
Functions
Name | Description |
---|---|
createManualEvent()
|
Creates a new signal that can be shared between fibers. |
createMonitor(mutex)
|
Creates a new monitor primitive for type T .
|
createSharedManualEvent()
|
Creates a new signal that can be shared between fibers. |
createSharedTaskSemaphore(max_locks)
|
Creates a new semaphore object. |
createTaskSemaphore(max_locks)
|
Creates a new semaphore object. |
scopedMutexLock(mutex, mode)
|
Performs RAII based locking/unlocking of a mutex. |
Interfaces
Name | Description |
---|---|
Lockable
|
Classes
Name | Description |
---|---|
InterruptibleRecursiveTaskMutex
|
Alternative to RecursiveTaskMutex that supports interruption.
|
InterruptibleTaskCondition
|
Alternative to TaskCondition that supports interruption.
|
InterruptibleTaskMutex
|
Alternative to TaskMutex that supports interruption.
|
InterruptibleTaskReadWriteMutex
|
Alternative to TaskReadWriteMutex that supports interruption.
|
LocalTaskSemaphore
|
Thread-local semaphore implementation for tasks. |
RecursiveTaskMutex
|
Recursive mutex implementation for tasks. |
TaskCondition
|
Event loop based condition variable or "event" implementation. |
TaskMutex
|
Mutex implementation for fibers. |
TaskReadWriteMutex
|
A ReadWriteMutex implementation for fibers. |
TaskSemaphore
|
Thread-local semaphore implementation for tasks. |
Structs
Name | Description |
---|---|
LocalManualEvent
|
A manually triggered single threaded cross-task event. |
ManualEvent
|
A manually triggered multi threaded cross-task event. |
Monitor
|
Synchronization primitive to ensure accessing a piece of data is always protected by a locked mutex. |
ScopedMutexLock
|
RAII lock for the Mutex class. |
Enums
Name | Description |
---|---|
LockMode
|