`shared Mutex`?

Aiden via Digitalmars-d-learn digitalmars-d-learn at puremagic.com
Mon Dec 29 00:26:22 PST 2014


On Sunday, 28 December 2014 at 20:36:07 UTC, ketmar via 
Digitalmars-d-learn wrote:
> you can turn that method to template. for now it is virtual 
> method and
> compiler is unable to inline it.

Are you suggesting something like the following...

void lock(alias m)() if(is(typeof(m) == shared(Mutex))) {
   (cast(Mutex)m).lock();
}

void unlock(alias m)() if(is(typeof(m) == shared(Mutex))) {
   (cast(Mutex)m).unlock();
}

...and then calling lock!mySharedMutex() and 
unlock!mySharedMutex()? Is there a way to generate a bunch of 
these in a similar way to `alias this`?


More information about the Digitalmars-d-learn mailing list