www.delorie.com/gnu/docs/guile/guile_371.html   search  
 
Buy GNU books!


Guile Reference Manual

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

32.4.2 Higher level thread procedures

Higher level thread procedures are available by loading the (ice-9 threads) module. These provide standardized thread creation and mutex interaction.

Scheme Procedure: %thread-handler tag args...

This procedure is specified as the standard error-handler for make-thread and begin-thread. If the number of args is three or more, use display-error, otherwise display a message "uncaught throw to tag". All output is sent to the port specified by current-error-port.

Before display, global var the-last-stack is set to #f and signals are unmasked with unmask-signals.

[FIXME: Why distinguish based on number of args?! Cue voodoo music here.]

macro: make-thread proc [args...]
Apply proc to args in a new thread formed by call-with-new-thread using %thread-handler as the error handler.

macro: begin-thread first [rest...]
Evaluate forms first and rest in a new thread formed by call-with-new-thread using %thread-handler as the error handler.

macro: with-mutex m [body...]
Lock mutex m, evaluate body, and then unlock m. These sub-operations form the branches of a dynamic-wind.

macro: monitor first [rest...]
Evaluate forms first and rest under a newly created anonymous mutex, using with-mutex.

[FIXME: Is there any way to access the mutex?]


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