mirror of
https://github.com/ceph/ceph
synced 2025-03-11 02:39:05 +00:00
common/ceph_mutex: add green thread-requiring condition variable for crimson
Signed-off-by: Radoslaw Zarzynski <rzarzyns@redhat.com>
This commit is contained in:
parent
8c01fa651e
commit
89b322d387
@ -15,6 +15,7 @@
|
||||
// naming the mutex for the purposes of the lockdep debug variant.
|
||||
|
||||
#if defined(WITH_SEASTAR) && !defined(WITH_ALIEN)
|
||||
#include <seastar/core/condition-variable.hh>
|
||||
|
||||
namespace ceph {
|
||||
// an empty class satisfying the mutex concept
|
||||
@ -33,11 +34,26 @@ namespace ceph {
|
||||
void unlock_shared() {}
|
||||
};
|
||||
|
||||
// this implementation assumes running within a seastar::thread
|
||||
struct green_condition_variable : private seastar::condition_variable {
|
||||
template <class LockT>
|
||||
void wait(LockT&&) {
|
||||
seastar::condition_variable::wait().get();
|
||||
}
|
||||
|
||||
void notify_one() noexcept {
|
||||
signal();
|
||||
}
|
||||
|
||||
void notify_all() noexcept {
|
||||
broadcast();
|
||||
}
|
||||
};
|
||||
|
||||
using mutex = dummy_mutex;
|
||||
using recursive_mutex = dummy_mutex;
|
||||
using shared_mutex = dummy_shared_mutex;
|
||||
// in seastar, we should use a difference interface for enforcing the
|
||||
// semantics of condition_variable
|
||||
using condition_variable = green_condition_variable;
|
||||
|
||||
template <typename ...Args>
|
||||
dummy_mutex make_mutex(Args&& ...args) {
|
||||
|
Loading…
Reference in New Issue
Block a user