Stdin

Asynchronous access to stdin. The constructor is private to ensure that access is provided only via an environment.

actor tag Stdin

Constructors

_create

new tag _create(
  use_event: Bool val)
: Stdin tag^

Parameters

  • use_event: Bool val

Returns


Public Behaviours

apply

Set the notifier. Optionally, also sets the chunk size, dictating the maximum number of bytes of each chunk that will be passed to the notifier.

be apply(
  notify: (StdinNotify iso | None val),
  chunk_size: USize val = seq)

Parameters


dispose

Clear the notifier in order to shut down input.

be dispose()

Private Behaviours

_loop_read

If we are able to read from stdin, schedule another read.

be _loop_read()

_event_notify

When the event fires, read from stdin.

be _event_notify(
  event: Pointer[AsioEvent val] tag,
  flags: U32 val,
  arg: U32 val)

Parameters


_read_again

Resume reading.

be _read_again()

Private Functions

_set_notify

Set the notifier.

fun ref _set_notify(
  notify: (StdinNotify iso | None val))
: None val

Parameters

Returns


_read

Read a chunk of data from stdin. Read a maximum of _chunk_size bytes, send ourself a resume message and stop reading to avoid starving other actors.

fun ref _read()
: Bool val

Returns


_close_event

Close the event.

fun ref _close_event()
: None val

Returns