Threading Questions

Jonathan M Davis via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Sun Oct 4 17:23:10 PDT 2015


On Sunday, October 04, 2015 14:42:48 bitwise via Digitalmars-d-learn wrote:
> Since D is moving towards a phobos with no GC, what will happen
> to things that are classes like Condition and Mutex?

Phobos and druntime will always use the GC for some things, and some things
just plain need classes. Rather, we're trying to make it so that Phobos does
not use the GC when it doesn't need to use the GC as well reduce how much
the GC is required for stuff like string processing where lazy ranges can be
used instead in many cases.

As for Condition and Mutex specifically, I don't know whey they were ever
classes except perhaps to take advantage of the monitor in Object. Maybe
they'll get changed to structs, maybe they won't, but most D code is
thread-local, and most of the code that isn't is going to use message
passing, which means that explicit mutexes and conditions are unnecessary.
So, most code won't be impacted regardless of what we do with Condition and
Mutex.

Regardless, I doubt that anything will be done with Condition or Mutex until
shared is revisted, which is supposed to happen sometime soon but hasn't
happened yet. What happens with shared could completely change how Condition
and Mutex are handled (e.g. they don't support shared directly even though
they should probably have most of their members marked with shared, because
Sean Kelly didn't want to be doing anything with shared that he'd have to
change later).

- Jonathan M Davis



More information about the Digitalmars-d-learn mailing list