Yieldable function?

2015-08-13 Thread Tofu Ninja via Digitalmars-d-learn
Is there any way to have a yieldable function that can be resumed at a later time in D? Some thing like: void test() { writeln(A); yeild(); writeln(B); } ... auto x = yieldable!test(); x.resume(); // prints A x.resume(); // prints B x.resume(); // throws an error or something

Re: Yieldable function?

2015-08-13 Thread MrSmith via Digitalmars-d-learn
http://dlang.org/phobos/core_thread.html#.Fiber

Re: Yieldable function?

2015-08-13 Thread Tofu Ninja via Digitalmars-d-learn
On Thursday, 13 August 2015 at 22:29:17 UTC, MrSmith wrote: http://dlang.org/phobos/core_thread.html#.Fiber Man I feel like I saw that before but when I went looking for it I couldn't find it. Didn't think to check in core. :/ Welp that solves my question, thanks :D

Re: Yieldable function?

2015-08-13 Thread Adam D. Ruppe via Digitalmars-d-learn
On Thursday, 13 August 2015 at 22:27:31 UTC, Tofu Ninja wrote: Also how portable is the built in asm support it varies a bit across compilers (gdc does it differently), and obviously across processors. Also is there a way to define naked functions in D? Put the `naked;`

Re: Yieldable function?

2015-08-13 Thread Ali Çehreli via Digitalmars-d-learn
On 08/13/2015 03:36 PM, Tofu Ninja wrote: On Thursday, 13 August 2015 at 22:29:17 UTC, MrSmith wrote: http://dlang.org/phobos/core_thread.html#.Fiber Man I feel like I saw that before but when I went looking for it I couldn't find it. Didn't think to check in core. :/ Welp that solves my