Factory site Cell#

The Cell site creates a write-once storage location.

(default method)#

site Cell[A]() :: A

Preconditions Required/Postconditions Asserted/Invariants Maintained#

Side-Effects of Invocation/State Maintained#

Abnormal Outcomes#

External Dependencies#

Performance Characteristics #


Cell Instances#

State Maintained#

Each Cell instance maintains a reference to zero or one contained value.

read#

Read a value from the cell. If the cell does not yet have a value, block until it receives one.
site Cell[A].read() :: A

Idempotent Blocking

Postconditions Asserted#

Cell has been written to.

readnb#

Read a value from the cell. If the cell does not yet have a value, halt.

site Cell[A].readnb() :: A

Idempotent Non-blocking

Postconditions Asserted#

If the readnb call published, the cell has been written to.

write#

Write a value to the cell. If the cell already has a value, halt.

site Cell[A].write() :: Top

Idempotent Non-blocking

Preconditions Required/Postconditions Asserted/Invariants Maintained#

Side-Effects of Invocation/State Maintained#

Abnormal Outcomes#

External Dependencies#

Performance Characteristics #

Example(s)#

Example 1#

-- Publishes: 5 5
val c = Cell()
  c.write(5) >> c.read()
| Rtimer(1) >> ( c.write(10) ; c.read() )

Related Reference Topics#


Related Tutorial Sections#

Add new attachment

Only authorized users are allowed to upload new attachments.
« This page (revision-4) was last changed on 20-Sep-2013 10:44 by JohnThywissen