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 vibe.core.core.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!

Members

Classes

InterruptibleRecursiveTaskMutex
class InterruptibleRecursiveTaskMutex

Alternative to RecursiveTaskMutex that supports interruption.

InterruptibleTaskCondition
class InterruptibleTaskCondition

Alternative to TaskCondition that supports interruption.

InterruptibleTaskMutex
class InterruptibleTaskMutex

Alternative to TaskMutex that supports interruption.

InterruptibleTaskReadWriteMutex
class InterruptibleTaskReadWriteMutex

Alternative to TaskReadWriteMutex that supports interruption.

LocalTaskSemaphore
class LocalTaskSemaphore

Thread-local semaphore implementation for tasks.

RecursiveTaskMutex
class RecursiveTaskMutex

Recursive mutex implementation for tasks.

TaskCondition
class TaskCondition

Event loop based condition variable or "event" implementation.

TaskMutex
class TaskMutex

Mutex implementation for fibers.

TaskReadWriteMutex
class TaskReadWriteMutex

A ReadWriteMutex implementation for fibers.

Enums

LockMode
enum LockMode
Undocumented in source.

Functions

createManualEvent
LocalManualEvent createManualEvent()

Creates a new signal that can be shared between fibers.

createMonitor
shared(Monitor!(T, M)) createMonitor(M mutex)
Undocumented in source. Be warned that the author may not have intended to support it.
createSharedManualEvent
shared(ManualEvent) createSharedManualEvent()

Creates a new signal that can be shared between fibers.

performLocked
ReturnType!PROC performLocked(MUTEX mutex)

private

scopedMutexLock
ScopedMutexLock!M scopedMutexLock(M mutex, LockMode mode)

Performs RAII based locking/unlocking of a mutex.

Interfaces

Lockable
interface Lockable
Undocumented in source.

Structs

LocalManualEvent
struct LocalManualEvent

A manually triggered single threaded cross-task event.

ManualEvent
struct ManualEvent

A manually triggered multi threaded cross-task event.

Monitor
struct Monitor(T, M)
Undocumented in source.
ScopedMutexLock
struct ScopedMutexLock(M)

RAII lock for the Mutex class.

Meta

Authors

Leonid Kramer, Sönke Ludwig, Manuel Frischknecht

License

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