How to use core.thread.Thread

byron via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Thu Jul 16 14:50:35 PDT 2015


On Thursday, 16 July 2015 at 21:48:06 UTC, byron wrote:
> On Thursday, 16 July 2015 at 07:57:13 UTC, aki wrote:
>> [...]
>
>
>
> If I remember a synchronized method requires "this" to be 
> shared, you should be fine using a synchronized block in the 
> method for non-shared instances.  But using atomicOp will avoid 
> a lock.
>
> void inc() {
>   synchronized {
> 		++count;
>   }
> }
>
> You are locking on this object instance by default

Also this is from Andrie's book
http://www.informit.com/articles/article.aspx?p=1609144


More information about the Digitalmars-d-learn mailing list