This module implements some core async thread synchronization primitives.
Types
ThreadSignal = object when defined(windows): elif hasEventFd: else:
- Source Edit
Procs
proc close(signal: ThreadSignalPtr): Result[void, string] {....raises: [], tags: [], forbids: [].}
- Close ThreadSignal object and free all the resources. Source Edit
proc fire(signal: ThreadSignalPtr): InternalRaisesFuture[void, (AsyncError, CancelledError)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [], forbids: [].}
- Source Edit
proc fireSync(signal: ThreadSignalPtr; timeout = InfiniteDuration): Result[bool, string] {....raises: [], tags: [], forbids: [].}
-
Set state of signal to signaled state in blocking way.
Returns false if signal was not signalled in time, and true if operation was successful.
Source Edit proc new(t: typedesc[ThreadSignalPtr]): Result[ThreadSignalPtr, string] {. ...raises: [].}
- Create new ThreadSignal object. Source Edit
proc wait(signal: ThreadSignalPtr): InternalRaisesFuture[void, (AsyncError, CancelledError)] {....stackTrace: false, raises: [], gcsafe, raises: [], tags: [], forbids: [].}
- Source Edit
proc waitSync(signal: ThreadSignalPtr; timeout = InfiniteDuration): Result[bool, string] {....raises: [], tags: [], forbids: [].}
- Wait until the signal become signaled. This procedure is NOT async, so it blocks execution flow, but this procedure do not need asynchronous event loop to be present. Source Edit