Problems with Mutex

ketmar via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Oct 27 06:34:35 PDT 2014


On Mon, 27 Oct 2014 09:24:13 -0400
Steven Schveighoffer via Digitalmars-d-learn
<digitalmars-d-learn at puremagic.com> wrote:

> Just as a followup, for some reason Mutex is not callable as a shared 
> object, so you have to make it __gshared.
> 
> This is unfortunate, but it is the only way to do it right now.
> Because an actual mutex is thread safe, it is not a problem.
p.s. generally you have to write code that can be used with shared vars
with special accuracy. that's why D made a clear distinction between
shared and thread variables and classes. you must explicitly declare
your intention to use something as shared. generally this increases
code safety and allows to writte better code.

this can be somewhat unusual for those who used to use C/C++ before, as
there is no such "guards" though.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 181 bytes
Desc: not available
URL: <http://lists.puremagic.com/pipermail/digitalmars-d-learn/attachments/20141027/2ae4c450/attachment.sig>


More information about the Digitalmars-d-learn mailing list