vibe.d beta banner
get vibe.d
0.10.1

Asynchronous I/O that doesn’t get in your way, written in D

Module vibe.core.sync

Event loop compatible task synchronization facilities.

This module provides replacement primitives for the modules in core.sync 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

NameDescription
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

NameDescription
Lockable

Classes

NameDescription
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

NameDescription
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

NameDescription
LockMode
Authors

Leonid Kramer, Sönke Ludwig, Manuel Frischknecht

Copyright

© 2012-2019 Sönke Ludwig

License

Subject to the terms of the MIT license, as written in the included LICENSE.txt file.