From: Kefu Chai Date: Tue, 22 Jun 2021 12:03:25 +0000 (+0800) Subject: crimson/os: reduce the scope of lock X-Git-Tag: v17.1.0~1579^2~2 X-Git-Url: http://git-server-git.apps.pok.os.sepia.ceph.com/?a=commitdiff_plain;h=924f90cf9a7455d13f11f2d7f43ac1a3074bb481;p=ceph.git crimson/os: reduce the scope of lock we just need to synchronize accesses to `stopping`, so only need to guard the mutation of it. Signed-off-by: Kefu Chai --- diff --git a/src/crimson/os/alienstore/thread_pool.h b/src/crimson/os/alienstore/thread_pool.h index fd22c9743db5..25bd782d7014 100644 --- a/src/crimson/os/alienstore/thread_pool.h +++ b/src/crimson/os/alienstore/thread_pool.h @@ -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) {