DMD 1.022 and 2.005 releases - what's wrong with threading?

David Brown dlang at davidb.org
Sat Oct 6 21:00:00 PDT 2007


On Sun, Oct 07, 2007 at 05:36:08AM +0200, downs wrote:

>> The threading package in Phobos is not very good, as it is based on my
>> very poor understanding of the problem. Drop kicking std.thread is
>> certainly open for discussion for v2. I wouldn't shed a tear for it <g>.
>
>Maybe I'm missing something here; maybe it's because Phobos' threading
>is all I ever used, but what's wrong with it?
>I mean, it's threads .. you can start them, halt them, run stuff in them
>.. what more is needed? It's a very basic implementation, very close to
>the OS; but thanks to synchronized, I generally found it easy to add the
>primitives I needed.

I don't know much (if anything) about threading on Windows, but the Linux
threading code is not really all that useful.  Without either reaching
under the hood or bypassing D's synchronized entirely, there is no way to
even build the right primitives to get to condition variables, so
synchronization isn't even possible.  It is possible to create independent
threads that do separate things, but not to have them really interact with
each other.

I think it is important to have thread synchronization primitives as part
of the basic threading library that work the same on all platforms.  This
greatly helps portability of threaded programs.

.NET uses something similar to 'synchronized', although they also provide
methods for providing visibility into the mutex itself.  They use condition
variables.  I wouldn't suspect these are that difficult to implement on
Windows.

David



More information about the Digitalmars-d mailing list