2009-09-14 13:44:01 +00:00
|
|
|
/*
|
|
|
|
NOTE: This file is not used - it is here just for reference. The
|
|
|
|
real module is defined internally in io.d.
|
|
|
|
*/
|
|
|
|
|
2009-01-20 08:29:15 +00:00
|
|
|
singleton thread;
|
|
|
|
|
|
|
|
// Used to kill or pause our own or other threads.
|
|
|
|
idle kill();
|
|
|
|
idle pause();
|
|
|
|
|
|
|
|
// Get status information about a thread
|
|
|
|
native bool isScheduled();
|
|
|
|
native bool isPaused();
|
|
|
|
native bool isIdle();
|
|
|
|
native bool isDead();
|
|
|
|
bool isAlive() { return !isDead(); }
|
|
|
|
|
|
|
|
// Create a new (paused) thread for a given function
|
2009-09-14 13:44:01 +00:00
|
|
|
native thread create(function() f);
|
2009-01-20 08:29:15 +00:00
|
|
|
|
|
|
|
// Schedule a (paused) thread to run the next frame
|
|
|
|
native restart();
|
|
|
|
|
|
|
|
// Call a (paused) thread directly - returns when the thread exits or
|
|
|
|
// calls an idle function.
|
2009-09-14 13:44:01 +00:00
|
|
|
idle call();
|
2009-01-20 08:29:15 +00:00
|
|
|
|
|
|
|
// Wait for a thread to finish. Will not return until the thread is
|
|
|
|
// dead.
|
|
|
|
idle wait();
|
|
|
|
|
|
|
|
// Start a function as a thread in the background
|
2009-09-14 13:44:01 +00:00
|
|
|
thread start(function() f)
|
2009-01-20 08:29:15 +00:00
|
|
|
{
|
2009-09-14 13:44:01 +00:00
|
|
|
var t = create(f);
|
2009-01-20 08:29:15 +00:00
|
|
|
t.restart();
|
|
|
|
return t;
|
|
|
|
}
|