Disallow thread local concepts to allow fibers move between threads @notl

Richard (Rikki) Andrew Cattermole richard at cattermole.co.nz
Mon Jun 17 16:37:54 UTC 2024


On 18/06/2024 4:19 AM, Sebastiaan Koppe wrote:
> On Saturday, 15 June 2024 at 13:12:12 UTC, Richard (Rikki) Andrew 
> Cattermole wrote:
>> On 16/06/2024 1:07 AM, Sebastiaan Koppe wrote:
>>> In your opening post you say fibers lost, which I agree with, but 
>>> then proceed to propose 3 new attributes for a fiber library feature 
>>> which is  essentially mimicking globals. Why would we want to make it 
>>> easier to do the wrong thing?
>>
>> 1. Migration to better event loops without forcing everyone to rewrite 
>> the world and in turn lowering the cost of adoption.
> 
> I'll like to see those event loops before proposing to change the language.
> 
> Also, I am skeptical of not having to rewrite things. As much as I want 
> to avoid it, I just don't see it happening.

Have you looked at vibe.d eventcore implementation?

Its not IOCP. It is polling everywhere.

Either it gets adapted to IOCP or its stuck with polling and bad 
performance.

Might as well kick start the eventloop rewrite before we get stackless 
coroutines.

But that means fibers need to be made "safe" to move between threads.

>> 2. It'll map into stackless, we'll need a solution there to prevent 
>> escaping for things like locks between states. So it isn't a waste of 
>> effort.
> 
> Holding synchronous locks across suspension points isn't recommended. 
> You'll want to avoid it by switching to async locks or use lock-free 
> algorithms.

Yes, the language shouldn't be allowing that.

It could never be right. It needs more information on library types to 
prevent it.


More information about the dip.ideas mailing list