Funicular is a shared-memory concurrency library for Scala on the JVM. It is based on a port to Scala of the language runtime system for X10.

Funicular is still a work in progress. The source code is released under the Eclipse Public License and is available from SVN by following these instructions. If you want to contribute, please contact . Funicular requires Scala 2.8.0 or later.

Features

Funicular supports the following features.

Asynchronous activities

The expression async { S } spawns an asynchronous activity with body S. The expression S runs concurrently with subsequent code. The library utilizes a thread pool and performs work-stealing to reduce the overhead of spawning new activities.

Activities can also be spawned for loop iterations using a foreach statement.

Futures

The expression future(e) spawns an asynchronous activity with body e. The expression e runs concurrently with subsequent code. Unlike an asyncs, a future returns a handle to the activity. Forcing the future blocks until the activity completes, returning the result of evaluating e.

The expression delayedFuture(e) spawns a future that does not begin execution immediately. Execution starts when the start method is called on the future.

Finish

The expression finish S waits for the termination of all dynamically nested asynchronous activities.

Clocks

An async may take an optional sequence of clocks. The next operation will block until all activities registered on the clock have reached next.

Atomic

The expression atomic S evaluates S isolated from other activities. The expression when (e) S evaluates S isolated from other activities, blocking until e is true.