is(Mutex == shared) == false?
Sean Kelly
sean at invisibleduck.org
Tue Feb 11 13:08:23 PST 2014
On Tuesday, 11 February 2014 at 17:09:39 UTC, Stanislav Blinov
wrote:
>
> Maybe an additional function like this could be helpful:
>
> --8<--
>
> HeadUnshared!T localOp(string op,T,V)(T what, V mod) if (is(T
> == shared))
> { ... }
>
> -->8--
>
> Or even something like this:
>
> --8<--
>
> ref auto assumeLocal(T)(ref T v) if (is(T == shared))
> {
> // Cast via pointer to preserve lvalue
> return *cast(HeadUnshared!T*)&v;
> }
>
> -->8--
>
> With which we can perform this:
>
> --8<--
>
> --assumeLocal(m_numWaitersBlocked);
>
> -->8--
>
> What do you think?
I think it's a good idea. Please file bugzilla requests for this
and the final method issue :-)
Regarding making Mutex methods final, this may require some care
because existing projects might rely on them being virtual. I'm
pretty sure vibe.d, for example, overrides Condition as well. I
don't know what the best process is for changing these to final
in terms of breaking code.
More information about the Digitalmars-d
mailing list