previous up next     contents index
Next: Integration with Threads Up: Threads Previous: Subprocesses in Embedded MzScheme

Sleeping with Embedded MzScheme

 

    Sometimes, MzScheme needs to sleep for a certain number of seconds. A proper implementation of sleeping does not necessaily block the entire application when MzScheme is being used as an embedded interpreter; therefore, the global function pointer  scheme_sleep is available to be set by an embedding application. It should be set to a function which takes an float number of seconds to sleep and returns void.

  Another sleep mode requires MzScheme to sleep until there is input from an external file descriptor. The global function pointer  scheme_wakeup_on_input can be set to a function which takes a pointer to an  fd_set record. This function should not sleep, but should install a checking mechanism on these file descriptors; MzScheme will turn off thread-checking; then, when there is any activity on the file descriptors, the function  scheme_wake_up should be invoked. The effect of waking up is that thread-checking will be re-enabled.



PLT