## 5.18 Unit: srfi-18

A simple multithreading package. This threading package follows largely the specification of SRFI-18. For more information see the documentation for SRFI-18 23

Notes:

- Blocking I/O will block all threads, except for some socket operations (see the section about the `tcp` unit).

- It is generally not a good idea for one thread to call a continuation created by another thread, if `dynamic-wind` is involved.

- When more than one thread compete for the current time-slice, the thread that was waiting first will become the next runnable thread.

- The dynamic environment of a thread consists of the following state:

  - The current input-, output- and error-port

  - The current exception handler

  - The values of all current parameters (created by `make-parameter`)

  - Any pending `dynamic-wind` thunks.

The following procedures are provided, in addition to the procedures defined in SRFI-18:

[procedure] (thread-deliver-signal! THREAD X)
  This will cause `THREAD` to signal the condition `X` once it is scheduled for execution. After signalling the condition, the thread continues with its normal execution.

[procedure] (thread-quantum THREAD)
  Returns the quantum of `THREAD`, which is an exact integer specifying the approximate time-slice of the thread.

[procedure] (thread-quantum-set! THREAD QUANTUM)
  Sets the quantum of `THREAD` to `QUANTUM`.

23 http://srfi.schemers.org/srfi-18/srfi-18.html