Fiber implementation questions

Dicebot via Digitalmars-d digitalmars-d at puremagic.com
Mon Jun 20 10:01:58 PDT 2016


On 06/20/2016 06:43 PM, Ilya Yaroshenko wrote:
> Hello,
> 
> I am thinking about faster event loop that vibe.d has (does not matter
> what driver are used). I want to implement (at least DIP) advanced Fiber
> yielding loop that can allow to eliminate context switching for all kind
> of event waiters.
> 
> Q1: Is it save to detach Fiber context from one thread and attach it to
> another thread?

No, not without special (expensive) runtime and possibly compiler
support. Primarily because TLS.

> Q2: core.thread.Fiber implementation looks like GC does not scan
> function stacks for yielded contexts. Why?

Don't know. It indeed sounds wrong though I have never experienced
premature collection with fibers so the matter maybe more complicated
than it seems.


More information about the Digitalmars-d mailing list