synchronized (this[.classinfo]) in druntime and phobos

Dmitry Olshansky dmitry.olsh at gmail.com
Wed May 30 06:24:08 PDT 2012


On 30.05.2012 17:14, Regan Heath wrote:
>> synchronized class Container
>> {
>>
>> void applyLocked(scope delegate void(Container _this));
>> ...
>> }
>
> Neat :)
>
Rewritten and almost complete:

synchronized class Locked!(C)
{
	void applyLocked(scope delegate void(C _this) dg)
	{//should have lock/unlock already, as every sync'ed class
		gd(_this); 	
	}

	final auto opDispatch(string mtd, Args...)(Args args)
	{//can't go alias this, it won't be locked I think
		return mixin("_this."~mtd~"("~args~")");
	}
private:
	C _this;
}


-- 
Dmitry Olshansky


More information about the Digitalmars-d mailing list