Is it safe to reset HOLD fiber?

Martin Nowak via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun May 3 07:36:03 PDT 2015


On Sunday, 3 May 2015 at 12:33:36 UTC, Dzugaru wrote:
> Documentation says "This fiber must be in state TERM." but in 
> the core.thread I see In contract only on reset without 
> parameters (bug maybe?) and with HOLD condition too:
> "assert( m_state == State.TERM || m_state == State.HOLD );"
>
> Does that mean its ok to reset the fiber if I'm not using 
> things like scope(exit)? I don't like adding 
> "if(fibIsDestroyed) return;" snippet after each Fiber.delay() - 
> its error-prone.

Actually the documentation answers your question, please help to 
improve it if you don't find it clear enough.
http://dlang.org/phobos/core_thread.html#.Fiber.reset


More information about the Digitalmars-d-learn mailing list