package miou
Install
dune-project
Dependency
Authors
Maintainers
Sources
sha256=50aa6aa6767d3fe1875e35c69e4b1d92346a5f3a0349ac065f2efce6378c89c3
sha512=58736c04b4c5f11165fc04b7b1ffe7183852e994a3617cebc7ecaa6e88244b583712c3d04e5f82bc52241317b71c8c3262d188a6c8f398a3f7813c75a8fc52dd
doc/miou.sync/Miou_sync/Trigger/index.html
Module Miou_sync.Trigger
Source
is_initial t
determines whether the trigger t
is in the initial state.
is_signaled t
determines whether the trigger t
is in the signaled state.
await t
waits for the trigger to be signal
ed.
The return value is None
in case the trigger was signaled before await
or we resumed the underlying continuation normally. Otherwise, the return value is Some (exn, bt)
, which indicates that the underlying continuation has been cancelled and the caller should raise the exception. In either case, the caller is responsible for cleaning up. Usually this means making sure that no references to the trigger remain to avoid space leak.
After signal t
returns, the trigger has been put into the signaled state and any attached action (via on_signal
) has been called.
Note that under normal circumstance, signal
should never raise an exception. If an exception is raised by signal
, it means that the attached action raised an error.
on_signal t x y fn
attempts to attach the fn
action to the trigger t
and transition the trigger to the awaiting state. It must be safe to call fn t x y
from any context that signal
might be called from.
The return value is true
in case the action was attached successfully. Otherwise, the return value is false
, which means that the trigger was already in the signaled state.