Forks

trait Forks
class Object
trait Matchable
class Any

Type members

Types

A fork that has been successfully picked up and can be used. It represents exclusive access to a fork.

A fork that has been successfully picked up and can be used. It represents exclusive access to a fork.

Interface to a fork. The fork itself may be shared among multiple philosophers, in which case multiple SharedFork interfaces are created for one "physical" fork. These SharedForks then have to coordinate when accessing the underlying "physical" fork. Once SharedFork is successfully picked up from the table (see tryPickUp), the holder of the resulting HeldFork can use it to eat.

Interface to a fork. The fork itself may be shared among multiple philosophers, in which case multiple SharedFork interfaces are created for one "physical" fork. These SharedForks then have to coordinate when accessing the underlying "physical" fork. Once SharedFork is successfully picked up from the table (see tryPickUp), the holder of the resulting HeldFork can use it to eat.

Value members

Abstract methods

def letGo: SharedFork -⚬ Done

Gives up access to the fork.

Gives up access to the fork.

Releases the fork so that it can be acquired by others.

Releases the fork so that it can be acquired by others.

Attempts to pick up a shared fork. If successful, outputs HeldFork on the left. Does not wait for the shared fork to become available. If it is unavailable, outputs SharedFork on the right.

Attempts to pick up a shared fork. If successful, outputs HeldFork on the left. Does not wait for the shared fork to become available. If it is unavailable, outputs SharedFork on the right.

Implicits

Implicits

implicit

Ability of HeldFork to

Ability of HeldFork to

  • signal readiness (when picked up or done being used).
  • defer readiness by awaiting a Done signal.