Commit 6bb0c5db authored by David Feuer's avatar David Feuer Committed by David Feuer

Don't lock the MVar closure on tryReadMVar

It shouldn't be necessary to lock the `MVar` closure on `tryReadMVar`, since it
just reads one field of the structure and doesn't make any modifications. So
let's not.

Reviewers: bgamari, erikd, simonmar, fryguybob, osa1

Reviewed By: osa1

Subscribers: osa1, rwbarton, thomie, carter

Differential Revision: https://phabricator.haskell.org/D4905
parent 9a371d65
......@@ -1825,18 +1825,14 @@ stg_readMVarzh ( P_ mvar, /* :: MVar a */ )
stg_tryReadMVarzh ( P_ mvar, /* :: MVar a */ )
{
W_ val, info, tso, q;
W_ val;
LOCK_CLOSURE(mvar, info);
val = StgMVar_value(mvar);
if (StgMVar_value(mvar) == stg_END_TSO_QUEUE_closure) {
unlockClosure(mvar, info);
if (val == stg_END_TSO_QUEUE_closure) {
return (0, stg_NO_FINALIZER_closure);
}
val = StgMVar_value(mvar);
unlockClosure(mvar, info);
return (1, val);
}
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment