digitalmars.D.learn - Using Fibers without yield
- Unthread (33/33) Nov 27 2025 Is there any reason for this behavior?
- Richard (Rikki) Andrew Cattermole (6/6) Nov 27 2025 Here is the source code:
- Serg Gini (5/12) Nov 28 2025 I find it is quite unintuitive saying "has no scheduler" when in
Is there any reason for this behavior?
```D
import std.stdio, core.thread.fiber;
Fiber one, two;
void main() {
one = new Fiber(
delegate() {
while(1) {
stderr.writefln("one says two.state = %s", two.state);
two.call();
}
}
);
two = new Fiber(
delegate() {
while(1) {
stderr.writefln("two says one.state = %s", one.state);
one.call();
}
}
);
one.call();
}
```
Execution of one is suspended when it calls two, but then two
reports the state of one is not HOLD.
```
one says two.state = HOLD
two says one.state = EXEC
one says two.state = EXEC
Segmentation fault
```
Is this a bug or a feature? If the last then why?
Nov 27 2025
Here is the source code: https://github.com/dlang/dmd/blob/master/druntime/src/core/thread/fiber/base.d When you call the second fiber, the first is still executing as far as the call stack is concerned. It was never yielded. D's Fiber is a primitive, it has no scheduler or dependency management. It cannot do anything differently.
Nov 27 2025
On Friday, 28 November 2025 at 07:14:42 UTC, Richard (Rikki) Andrew Cattermole wrote:Here is the source code: https://github.com/dlang/dmd/blob/master/druntime/src/core/thread/fiber/base.d When you call the second fiber, the first is still executing as far as the call stack is concerned. It was never yielded. D's Fiber is a primitive, it has no scheduler or dependency management. It cannot do anything differently.I find it is quite unintuitive saying "has no scheduler" when in std we have this https://dlang.org/library/std/concurrency/fiber_scheduler.html
Nov 28 2025








Serg Gini <kornburn yandex.ru>