aboutsummaryrefslogtreecommitdiff
path: root/stm/workerPool.ml
diff options
context:
space:
mode:
authorcoqbot-app[bot]2021-04-12 12:34:16 +0000
committerGitHub2021-04-12 12:34:16 +0000
commit271445decd0fc1a37da3009f148f2e68c7168fe1 (patch)
tree631d9976d17d6573b0f348cfd6fdbd83bb779ddb /stm/workerPool.ml
parent7ce1c4844b077adb25d14cf1bbd2d22548b1e935 (diff)
parent520ac61dfe5a6e865cb7b10f4a822c0d72f3ded9 (diff)
Merge PR #14046: make critical sections safe in the presence of exceptions
Reviewed-by: ejgallego Ack-by: gares Ack-by: SkySkimmer Ack-by: gadmm
Diffstat (limited to 'stm/workerPool.ml')
-rw-r--r--stm/workerPool.ml7
1 files changed, 1 insertions, 6 deletions
diff --git a/stm/workerPool.ml b/stm/workerPool.ml
index 45c92c3748..fef9300377 100644
--- a/stm/workerPool.ml
+++ b/stm/workerPool.ml
@@ -72,12 +72,7 @@ let worker_handshake slave_ic slave_oc =
exit 1
let locking { lock; pool = p } f =
- try
- Mutex.lock lock;
- let x = f p in
- Mutex.unlock lock;
- x
- with e -> Mutex.unlock lock; raise e
+ CThread.with_lock lock ~scope:(fun () -> f p)
let rec create_worker extra pool priority id =
let cancel = ref false in