Alice provides concurrency as a fundamental language feature. The concurrency model is tightly coupled with futures. The library design regarding threads is not finalized yet. Currently, the basic primitive is available from the structure Future:
val concur: (unit -> 'a) -> 'a
It immediately returns a fresh future. The procedure will be applied in a new thread. When the application terminates the future is replaced with the result.
Other operations are provided through the structure Thread.
structure Thread: sig type thread datatype state = RUNNABLE | BLOCKED | TERMINATED exception Terminate val thread: (unit -> unit) -> thread val spawn: (unit -> 'a) -> thread * 'a val current: unit -> thread val state: thread -> state val yield: thread -> unit val sleep: int -> unit val raiseIn: thread * exn -> unit val terminate: thread -> unit val suspend: thread -> unit val resume: thread -> unit val isSuspended: thread -> bool end