[plt-scheme] waking a sleeping thread?

From: Matthew Flatt (mflatt at cs.utah.edu)
Date: Wed Mar 18 17:07:09 EDT 2009

At Wed, 18 Mar 2009 13:28:04 -0700, YC wrote:
> is there a way to wake a sleeping thread?  I thought I can do it with
> thread-resume, but apparently a sleeping thread isn't suspended.

You mean a thread that is in a call to `sleep', right?

You could send the thread a break signal, but that raises an exception.
There's no way to just have the `sleep' return immediately.

Instead of calling `sleep, you could make the thread call
`sync/timeout' with a timeout (for sleeping) plus some other value that
you use as a wake-up event.

Posted on the users mailing list.