summaryrefslogtreecommitdiff
path: root/rts/posix/Select.c
diff options
context:
space:
mode:
authorBen Gamari <ben@smart-cactus.org>2023-04-28 08:55:02 -0400
committerBen Gamari <ben@smart-cactus.org>2023-05-16 08:07:57 -0400
commitc8f74d5f6e9874424c1e55f586ff44568308a94c (patch)
tree2ff63bdd0dd80b4f7eed738a46ba129b06b65152 /rts/posix/Select.c
parent1e6861dd8612d8f71cc4635c4f73f84f316a6c7e (diff)
downloadhaskell-wip/clear-block-info.tar.gz
rts: Clear block_info when unblockingwip/clear-block-info
Otherwise we may end up with dangling pointers which may complicate debugging. Also, introduce more strict checking of block_info in checkTSO.
Diffstat (limited to 'rts/posix/Select.c')
-rw-r--r--rts/posix/Select.c2
1 files changed, 2 insertions, 0 deletions
diff --git a/rts/posix/Select.c b/rts/posix/Select.c
index 89a46fd763..ccbe9c4f24 100644
--- a/rts/posix/Select.c
+++ b/rts/posix/Select.c
@@ -106,6 +106,7 @@ static bool wakeUpSleepingThreads (Capability *cap, LowResTime now)
}
iomgr->sleeping_queue = tso->_link;
tso->why_blocked = NotBlocked;
+ tso->block_info.closure = (StgClosure *)END_TSO_QUEUE;
tso->_link = END_TSO_QUEUE;
IF_DEBUG(scheduler, debugBelch("Waking up sleeping thread %"
FMT_StgThreadID "\n", tso->id));
@@ -437,6 +438,7 @@ awaitEvent(Capability *cap, bool wait)
debugBelch("Waking up blocked thread %" FMT_StgThreadID "\n",
tso->id));
tso->why_blocked = NotBlocked;
+ tso->block_info.closure = (StgClosure *)END_TSO_QUEUE;
tso->_link = END_TSO_QUEUE;
pushOnRunQueue(cap,tso);
break;