Julien looked at this.
Branches: main
runtime/mercury_stm.c:
In MR_STM_block_thread, on resuming execution, don't release the STM
lock until after removing the thread's condition variable from the
transaction log.
diff --git a/runtime/mercury_stm.c b/runtime/mercury_stm.c
index 85634f6..73c9efa 100644
--- a/runtime/mercury_stm.c
+++ b/runtime/mercury_stm.c
@@ -370,13 +370,14 @@ MR_STM_block_thread(MR_STM_TransLog *tlog)
fprintf(stderr, "STM BLOCKING: log <0x%.8lx>\n", (MR_Word)tlog);
#endif
MR_STM_condvar_wait(thread_condvar, &MR_STM_lock);
- MR_UNLOCK(&MR_STM_lock, "MR_STM_block_thread");
#if defined(MR_STM_DEBUG)
fprintf(stderr, "STM RESCHEDULING: log <0x%.8lx>\n", (MR_Word)tlog);
#endif
MR_STM_unwait(tlog, thread_condvar);
+ MR_UNLOCK(&MR_STM_lock, "MR_STM_block_thread");
+
MR_GC_free(thread_condvar);
#else
MR_fatal_error("Blocking thread in non-parallel grade");
--------------------------------------------------------------------------
mercury-reviews mailing list
Post messages to:
mercury-reviews@...
Administrative Queries:
owner-mercury-reviews@...
Subscriptions:
mercury-reviews-request@...
--------------------------------------------------------------------------