diff options
author | Sage Weil <sage@inktank.com> | 2012-07-22 07:46:11 -0700 |
---|---|---|
committer | Sage Weil <sage@inktank.com> | 2012-07-26 15:03:35 -0700 |
commit | 6ed01df412b4f4745c8f427a94446987c88b6bef (patch) | |
tree | 7d572e4347048a3e65410cbdf1ff9898b4b3feeb /src/common | |
parent | d2d40dc3059d91450925534f361f2c03eec9ef88 (diff) | |
download | ceph-6ed01df412b4f4745c8f427a94446987c88b6bef.tar.gz |
workqueue: kick -> wake or _wake, depending on locking
Break kick() into wake() and _wake() methods, depending on whether the
lock is already held. (The rename ensures that we audit/fix all
callers.)
Signed-off-by: Sage Weil <sage@inktank.com>
Conflicts:
src/common/WorkQueue.h
src/osd/OSD.cc
Diffstat (limited to 'src/common')
-rw-r--r-- | src/common/WorkQueue.h | 19 |
1 files changed, 15 insertions, 4 deletions
diff --git a/src/common/WorkQueue.h b/src/common/WorkQueue.h index b02ce75dcc2..e55adb34e2c 100644 --- a/src/common/WorkQueue.h +++ b/src/common/WorkQueue.h @@ -99,8 +99,13 @@ public: void unlock() { pool->unlock(); } - void kick() { - pool->kick(); + /// wake up the thread pool (without lock held) + void wake() { + pool->wake(); + } + /// wake up the thread pool (with lock already held) + void _wake() { + pool->_wake(); } void drain() { pool->drain(this); @@ -182,8 +187,14 @@ public: void wait(Cond &c) { c.Wait(_lock); } - /// wake up a waiter - void kick() { + + /// wake up a waiter (with lock already held) + void _wake() { + _cond.Signal(); + } + /// wake up a waiter (without lock held) + void wake() { + Mutex::Locker l(_lock); _cond.Signal(); } |