Disabling synchronized blocks locking overhead?

Sean Kelly sean at invisibleduck.org
Fri Jun 24 07:54:58 PDT 2011


If you synchronize via a Mutex you could create a type that detects whatever and doesn't actually lock if single threaded.  core.thread.thread_needLock() is an option if you can be sure a thread won't be spawned inside your magically not-locked function. 

Sent from my iPhone

On Jun 24, 2011, at 5:04 AM, d coder <dlang.coder at gmail.com> wrote:

> 
> Yes, there is a flag .. in the source code! Just download the source and apply this patch:
> 
> 
> Thanks
> 
> Most of the times I use explicit synchronized code blocks, instead of adding "synchronized" attribute to the function itself.
> 
> Would the patch you sent still work?
> 
> Regards
> - Puneet
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.puremagic.com/pipermail/digitalmars-d/attachments/20110624/268f4bfc/attachment.html>


More information about the Digitalmars-d mailing list