Threads allow for expressing concurrent programs.  The assumed model
is shared memory with explicit synchronization and symmetric
multiprocessing and is based heavily upon pthreads This section is preliminary and might change in the future.  There are
several limitations in the current implementation.  It represents a
rudimentary but usable subset of typical thread operations.  Tables
and vectors require user locks to ensure thread safety and no out of
language crashes.  Finally, the compiler, interpreter, and
(re)definition machinery are thread unsafe and can only reliably be
run in one thread.
| <thread> | (<any>) | C | 
|  | Represents a thread of executation schedulable across 
  multiple processors.  Upon creation executes thread-functionin separate thread. |  | 
| thread-name | (thread|<thread> => (t? <sym>)) | P | 
| thread-priority | (thread|<thread> => <int>) | P | 
| thread-function | (thread|<thread> => <fun>) | P | 
| new | (x|(t< <thread>) inits|... => <thread>) | M | 
|  | Creates thread and runs thread-functionof created
  thread in separate OS thread. |  | 
| SPAWN | (SPAWN ,@body) | S | 
|  | ==  (FAB <thread> thread-function (fun () ,@body)) |  | 
| thread-yield | () | M | 
|  | Surrenders processor to another thread. |  | 
| thread-join | (thread|<thread>) | M | 
|  | Causes current thread to wait for the termination of thread. |  | 
| thread-current | (=> <thread>) | M | 
| all-threads | (=> <tup>) | M | 
| sleep | (secs|<flo>) | M | 
|  | Pauses current thread for secsseconds. |  | 
| <lock> | (<any>) | C | 
|  | Represents a mutex. |  | 
| lock-name | (lock|<lock> => (t? <sym>)) | P | 
| new | (x|(t< <lock>) inits|... => <lock>) | M | 
| lock-lock | (lock|<lock>) | M | 
|  | Obtain exclusive access to lock waiting if necessary. |  | 
| lock-unlock | (lock|<lock>) | M | 
|  | Free up exclusive access to lock potentially allowing 
  another thread access. |  | 
| WITH-LOCK | (WITH-LOCK ,lock ,@body) | S | 
|  | ==  (FIN (SEQ (lock-lock ,lock) ,@body) (lock-unlock ,lock)) |  | 
| <event> | (<any>) | C | 
|  | Represents a condition variable used for interthread notification. |  | 
| event-name | (event|<event> => (t? <sym>)) | P | 
| new | (x|(t< <event>) inits|... => <event>) | M | 
| event-signal | (event|<event> lock|<lock>) | M | 
|  | Unblocks at least one thread waiting on event. |  | 
| event-broadcast | (event|<event> lock|<lock>) | M | 
|  | Unblocks all threads waiting on event. |  | 
| event-wait | (event|<event> lock|<lock> => <log>) | M | 
|  | Unlocks lockand places thread in waiting state to be
  resumed wheneventis signaled or broadcasted upon which timelockis reacquired and thread resumed. |  | 
| event-wait-timed | (event|<event> lock|<lock> secs|<flo> => <log>) | M | 
|  | Unlocks lockand places thread in waiting state to be
  resumed wheneventis signaled or broadcasted or timeoutsecsis reached upon which timelockis reacquired 
  and thread resumed. |  | 
| DDV | (DDV ,var ,form) | S | 
|  | Defines a thread local variable named (var-name ,var) with an 
  initial value ,form. |  | 
| DLET | (DLET ((,var ,val) ...) ,@body) | S | 
|  | ==  (LET ((,old-var ,var) ...) (FIN (SEQ (SET ,var
  ,val) ... ,@body) (SET ,var ,old-var) ...)) |  | 
| <pipe> | (<flat> <seq!>) | C | 
|  | Represents a synchronized FIFO queue allowing multiple readers
  and writers in separate threads. |  | 
| enq! | (pipe|<pipe> x => <pipe>) | M | 
|  | Adds xtopipe. |  | 
| deq! | (pipe|<pipe> => <any>) | M | 
|  | Removes and returns element from pipeor waits for one
  to be available. |  | 
|  |