Sourcecore/thread/fiber/base.d
FiberBase;WarningStatus registers are not saved by the current implementations. This means floating point exception status bits (overflow, divide by 0), rounding mode and similar stuff is set per-thread, not per Fiber!
WarningOn ARM FPU registers are not saved if druntime was compiled as ARM_SoftFloat. If such a build is used on a ARM_SoftFP system which actually has got a FPU and other libraries are using the FPU registers (other code is compiled as ARM_SoftFP) this can cause problems. Druntime must be compiled as ARM_SoftFP in this case.
int counter;class DerivedFiber : Fiber{this() {super( &run ); }private :void run() { counter += 2; }}void fiberFunc(){ counter += 4; Fiber.yield(); counter += 8;}// create instances of each typeFiber derived =new DerivedFiber();Fiber composed =new Fiber( &fiberFunc );assert( counter == 0 );derived.call();assert( counter == 2,"Derived fiber increment." );composed.call();assert( counter == 6,"First composed fiber increment." );counter += 16;assert( counter == 22,"Calling context increment." );composed.call();assert( counter == 30,"Second composed fiber increment." );// since each fiber has run to completion, each should have state TERMassert( derived.state == Fiber.State.TERM );assert( composed.state == Fiber.State.TERM );
fn, size_tsz, size_tguardPageSize);void function()fn | The fiber function. |
size_tsz | The stack size for this fiber. |
size_tguardPageSize | size of the guard page to trap fiber's stack overflows. Beware that using this will increase the number of mmaped regions on platforms using mmap so an OS-imposed limit may be hit. |
Infn must not be null.
dg, size_tsz, size_tguardPageSize);void delegate()dg | The fiber function. |
size_tsz | The stack size for this fiber. |
size_tguardPageSize | size of the guard page to trap fiber's stack overflows. Beware that using this will increase the number of mmaped regions on platforms using mmap so an OS-imposed limit may be hit. |
Indg must not be null.
call(Rethrowrethrow = Rethrow.yes);call(Rethrow rethrow)();Rethrowrethrow | Rethrow any unhandled exception which may have caused this fiber to terminate. |
InThis fiber must be in state HOLD.
Rethrow: bool;reset();reset(void function()fn);reset(void delegate()dg);InThis fiber must be in state TERM or HOLD.
State: int;HOLDEXECTERMstate() const;yield();yieldAndThrow(Throwablet);Throwablet | The object to throw. |
Int must not be null.
getThis();allocStack(size_tsz, size_tguardPageSize);