www.delorie.com/gnu/docs/kawa/kawa_44.html   search  
 
Buy GNU books!


Kawa, the Java-based Scheme system

[ < ] [ > ]   [ << ] [ Up ] [ >> ]         [Top] [Contents] [Index] [ ? ]

7.16 Threads

There is a very preliminary interface to create parallel threads. The interface is similar to the standard delay/force, where a thread is basically the same as a promise, except that evaluation may be in parallel.

So far, little or no effort has been made into making Kawa thread-safe. There are no per-thread bindings, and the current input and output parts are global. That needs to change.

Syntax: future expression
Creates a new thread that evaluates expression.

Function: force thread
The standard force function has generalized to also work on threads. If waits for the thread's expression to finish executing, and returns the result.

Function: sleep time
Suspends the current thread for the specified time. The time can be either a pure number (in secords), or a quantity whose unit is a time unit (such as 10s).


  webmaster     delorie software   privacy  
  Copyright 2003   by The Free Software Foundation     Updated Jun 2003