diff --git a/source/concurrency/sender.d b/source/concurrency/sender.d index 329bbf4..951ff87 100644 --- a/source/concurrency/sender.d +++ b/source/concurrency/sender.d @@ -570,18 +570,16 @@ class Promise(T) { } SharedBitField!Flags counter; - bool add(DG dg) @safe nothrow shared { - with (unshared) { - with (counter.lock()) { - if (was(Flags.completed)) { - auto val = value.match!((typeof(null)) => assert(0, "not happening"), v => v); - release(); // release early - dg(val); - return true; - } else { - dgs.pushBack(dg); - return false; - } + bool add(DG dg) @trusted nothrow shared { + with(counter.lock()) { + if (was(Flags.completed)) { + auto val = ((cast()this).value).match!((typeof(null)) => assert(0, "not happening"), v => v); + release(); // release early + dg(val); + return true; + } else { + dgs.pushBack(dg); + return false; } } } @@ -597,10 +595,6 @@ class Promise(T) { } } } - - private auto ref unshared() @trusted nothrow shared { - return cast() this; - } } private bool pushImpl(P)(P t) @safe shared nothrow {