From 28593c56088439112802c64b5a04f284afe04f14 Mon Sep 17 00:00:00 2001
From: Nicolas Pope <nicolas.pope@utu.fi>
Date: Thu, 17 Nov 2022 11:56:13 +0000
Subject: [PATCH] Use unique lock in trigger

---
 include/ftl/handle.hpp | 3 ++-
 1 file changed, 2 insertions(+), 1 deletion(-)

diff --git a/include/ftl/handle.hpp b/include/ftl/handle.hpp
index 534d788..d59c647 100644
--- a/include/ftl/handle.hpp
+++ b/include/ftl/handle.hpp
@@ -125,7 +125,8 @@ struct Handler : BaseHandler {
     void trigger(ARGS ...args) {
         bool hadFault = false;
         std::string faultMsg;
-        std::shared_lock<std::shared_mutex> lk(mutex_);
+        // FIXME: This should be a shared_lock but there is a race condition elsewhere.
+        std::unique_lock<std::shared_mutex> lk(mutex_);
         for (auto i = callbacks_.begin(); i != callbacks_.end(); ) {
             bool keep = true;
             try {
-- 
GitLab