[D-runtime] What's with core.sync.condition usage?

Alex Rønne Petersen xtzgzorex at gmail.com
Wed Apr 25 17:18:04 PDT 2012


Surely it could lock whatever it needs to lock internally?

See: http://msdn.microsoft.com/en-us/library/system.threading.autoresetevent.aspx

That class is entirely thread safe.

Regards,
Alex

On Thu, Apr 26, 2012 at 1:17 AM, Jonathan M Davis <jmdavisProg at gmx.com> wrote:
> On Thursday, April 26, 2012 00:41:40 Alex Rønne Petersen wrote:
>> Hi,
>>
>> What's with the weird, convoluted way one is supposed to use
>> core.sync.condition.Condition? Having to lock on a mutex while using a
>> Condition object is extremely weird compared to APIs in other
>> programming languages. Any particular reason behind this design?
>
> Really? In C++, from what I've seen, you always end up locking on a mutex to
> protect a condition variable. How could it work _without_ locking? The
> condition variable wouldn't be protected against multiple threads using it.
>
> - Jonathan M Davis
> _______________________________________________
> D-runtime mailing list
> D-runtime at puremagic.com
> http://lists.puremagic.com/mailman/listinfo/d-runtime


More information about the D-runtime mailing list