STM Exception "BlockedIndefinitelyOnSTM" throws to wrong thread
|Reported by:||guest||Owned by:|
|Type of failure:||None/Unknown||Test Case:|
|Related Tickets:||Differential Revisions:|
This might be two bugs. The attached test file (tvarTest.hs) aims to use a separate thread catching a "BlockedIndefinitelyOnSTM" exception to adjust the state of another TVar (a poor mans finalizer on TVars).
More concretely, with TVars "b" and "i" I have a thread (running "gcTVar") retrying on a read of "i" then alters "b" if/when the BlockIndefinitelyOnSTM exception is received. My main thread waits for the state of "b" to change (which is should, due to "gcTVar").
Unfortunately, compiling with GHC (6.12.3, 7.0.1, 7.0.3, threaded or not, optimized or not, it all behaves the same) the main thread receives the exception and not the thread running "gcTVar".
The behavior is different in GHCi. GHCi seems to operate correctly.