Asynchronous programming through ports and channels.

ICloseablePort

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -close!

A state protocol for ports that can be closed.

Resources in dunaj.resource use concept of blocking releasable instead of closeable.

-close!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-close! this)

Type signature:
  • (Any) → nil

Closes this and returns nil. Must not block.

See also: ICloseablePort

IMult

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -tap!, -untap!, -untap-all!

An abstract type protocol for Mults.

See also: mult?, mult!, tap!, untap!

-tap!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-tap! this port close?)

Type signature:
  • (Any ⨯ ITargetPort ⨯ Boolean+) → nil

Attaches port to this mult, using close? to determine whether port should be closed if this Mult’s source is closed.

See also: IMult

-untap!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-untap! this port)

Type signature:
  • (Any ⨯ ITargetPort) → nil

Detached port from this mult.

See also: IMult

-untap-all!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-untap-all! this)

Type signature:
  • (Any) → nil

Detaches all taps from this mult.

See also: IMult

IPub

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with methods -sub!, -unsub!, -unsub-all!

An abstract type protocol for Pub.

See also: pub?, pub!, sub!

-sub!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-sub! this topic port close?)

Type signature:
  • (Any ⨯ Any ⨯ ITargetPort ⨯ Boolean+) → nil

Subscribes target port in this Pub under given topic. close? determines whether port will be closed when this Pub’s source closes.

See also: IPub

-unsub!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-unsub! this topic port)

Type signature:
  • (Any ⨯ Any ⨯ ITargetPort) → nil

Unsubscribes port from this Pub and from given topic.

See also: IPub

-unsub-all!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-unsub-all! this)

  • (-unsub-all! this topic)

Type signatures:
  • (Any) → nil

  • (Any ⨯ Any) → nil

Unsubscribes all ports subscribed to given topic, or unsunscribes all ports, is no topic is given.

See also: IPub

ISourcePort

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -take!

A state protocol for source ports.

-take!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-take! this fn1-handler)

Type signature:
  • (Any ⨯ Any) → (Maybe IReference)

Returns derefable val if taken, nil if take was enqueued. Returns derefable nil if closed.

See also: ISourcePort

ITargetPort

Available since version 1.0 (view source)

not referred automatically

PROTOCOL with method -put!

A state protocol for target ports.

-put!

Available since version 1.0 (view source)

not referred automatically

Usage:
  • (-put! this val fn1-handler)

Type signature:
  • (Any ⨯ PortVal ⨯ Any) → (Maybe IReference)

Returns derefable boolean (false iff already closed) if handled, nil if put was enqueued. Must throw on nil val.

See also: ITargetPort