On this page:
Evt
Evt.sync
Evt.always
Evt.never
Progress  Evt
Commit  Evt
8.16.0.2

15.3 Synchronizable Events🔗ℹ

A synchronizable events is an object that can be used with Evt.sync to wait until it is ready for synchronization. Synchronizing a ready event may have a side effect and an associated value. For example, synchronizing on a Semaphore is the same as using Semaphore.wait, so it decrements the semaphore’s count.

annotation

Evt

An annotation that recognizes synchronizable events, which include threads, semaphores, an objects returned by methods like TCPListener.accept_evt.

The Evt annotation interface-like in the sense that every Evt supports the Evt.sync method.

method

method (evt :: Evt).sync(

  ~timeout: timeout_secs :: maybe(NonnegReal) = #false,

  ~enable_break: enable_break :: Any.to_boolean = #false,

  evt :: Evt,

  ...

) :: Any

Blocks until at least one of the evts is ready for synchronization, and returns the ready result. If multiple evts become ready before one is selected, one of the ready evts is selected at random.

value

def Evt.always :: Evt

 

value

def Evt.never :: Evt

The Evt.always synchronizable event is always ready for synchronization, and its synchronization result is itself.

The Evt.never synchronizable event is never ready for synchronization.

annotation

ProgressEvt

 

annotation

CommitEvt

A ProgressEvt is produced by Port.Input.Progress.evt to detect and synchronize reads from input ports that support progress events.

A CommitEvt is used in combination with a ProgressEvt for Port.Input.Progress.commit. A CommitEvt is either a Semaphore, channel-put event, channel, semaphore-peek event, Evt.always, or Evt.never.