[previous] [up] [next]     [index]
Next: Threads in Embedded MzScheme Up: Threads Previous: Integration with Threads

Blocking the Current Thread

Embedding or extension code sometimes needs to block, but blocking should allow other MzScheme threads to execute. To allow other threads to run, block using scheme_block_until. This procedure takes two functions: a polling function that tests whether the blocking operation can be completed, and a prepare-to-sleep function that sets bits in fd_sets when MzScheme decides to sleep (because all MzScheme threads are blocked). Under Windows and BeOS, an ``fd_set'' can also accomodate OS-level semaphores or other handles via scheme_add_fd_handle.



PLT