]> git-server-git.apps.pok.os.sepia.ceph.com Git - ceph.git/commitdiff
crimson/os: reduce the scope of lock
authorKefu Chai <kchai@redhat.com>
Tue, 22 Jun 2021 12:03:25 +0000 (20:03 +0800)
committerKefu Chai <kchai@redhat.com>
Wed, 23 Jun 2021 09:08:58 +0000 (17:08 +0800)
we just need to synchronize accesses to `stopping`, so only need to
guard the mutation of it.

Signed-off-by: Kefu Chai <kchai@redhat.com>
src/crimson/os/alienstore/thread_pool.h

index fd22c9743db577bcac7e78633747bcf696cba587..25bd782d7014700010bf30da49675996c210971d 100644 (file)
@@ -90,8 +90,10 @@ public:
     return work_item;
   }
   void stop() {
-    std::unique_lock lock{mutex};
-    stopping = true;
+    {
+      std::unique_lock lock{mutex};
+      stopping = true;
+    }
     cond.notify_all();
   }
   void push_back(WorkItem* work_item) {