| void function() fn | The thread function. |
| size_t sz | The stack size for this thread. |
| void delegate() dg | The thread function. |
| size_t sz | The stack size for this thread. |
| bool rethrow | Rethrow any unhandled exception which may have caused this thread to terminate. |
| char[] val | The new name of this thread. |
| bool val | The new daemon status for this thread. |
| int val | The new scheduling priority of this thread. |
| long period | The minimum duration the calling thread should be suspended, in 100 nanosecond intervals. |
Thread.sleep( 500_000 ); // sleep for 50 milliseconds Thread.sleep( 50_000_000 ); // sleep for 5 seconds
| int delegate(ref Thread) dg | The supplied code as a delegate. |
| uint key | The key to delete. |
| uint key | The location which holds the desired data. |
| uint key | The location to store the supplied data. |
| void* val | The data to store. |
| scanAllThreadsFn scan | The scanner function. It should scan from p1 through p2 - 1. |
| void* curStackTop | An optional pointer to the top of the calling thread's stack. |
| def | The default value to return if no value has been explicitly set. |
| T newval | The value to set. |
| void function() fn | The thread function. |
| void delegate() dg | The thread function. |
| Thread t | The thread to add. |
| Thread t | The thread to remove. |
| bool rethrow | Rethrow any unhandled exception which may have caused the current thread to terminate. |
class DerivedFiber : Fiber
{
this()
{
super( &run );
}
private :
void run()
{
printf( "Derived fiber running.\n" );
}
}
void fiberFunc()
{
printf( "Composed fiber running.\n" );
Fiber.yield();
printf( "Composed fiber running.\n" );
}
// create instances of each type
Fiber derived = new DerivedFiber();
Fiber composed = new Fiber( &fiberFunc );
// call both fibers once
derived.call();
composed.call();
printf( "Execution returned to calling context.\n" );
composed.call();
// since each fiber has run to completion, each should have state TERM
assert( derived.state == Fiber.State.TERM );
assert( composed.state == Fiber.State.TERM );
| void function() fn | The thread function. |
| size_t sz | The stack size for this fiber. |
| void delegate() dg | The thread function. |
| size_t sz | The stack size for this fiber. |
| bool rethrow | Rethrow any unhandled exception which may have caused this fiber to terminate. |
| Object obj | The object to throw. |