I was thinking this could be a nice thing to put into Slumber[1].
Any thoughts/ideas?
-Andreas
inline pause
{
callcc {
# add $1 back onto the waiting for a thread queue.
};
}
I wrote a whole article on continuations and compared them to user-
level threads:
http://today.java.net/pub/a/today/2008/07/24/fun-with-continuations.html
One thing you'll want to keep in mind though, fork() isolates each
thread in terms of variables and everything else. Due to the way
Sleep synchronizes itself, your implementation will need to do the
same. This shouldn't be too bad of a limitation though. When
executing SleepClosures just be sure to set their script owner and
global variables to the threads associated script environment. If
you do this you won't run into any problems.
Hope that helps.
-- Raphael