seastar::future<> write_lock::lock()
{
- return static_cast<tri_mutex*>(this)->lock_for_write(false);
+ return static_cast<tri_mutex*>(this)->lock_for_write();
}
void write_lock::unlock()
++readers;
}
-seastar::future<> tri_mutex::lock_for_write(bool greedy)
+seastar::future<> tri_mutex::lock_for_write()
{
- if (try_lock_for_write(greedy)) {
+ if (try_lock_for_write()) {
return seastar::make_ready_future<>();
}
waiters.emplace_back(seastar::promise<>(), type_t::write);
return waiters.back().pr.get_future();
}
-bool tri_mutex::try_lock_for_write(bool greedy) noexcept
+bool tri_mutex::try_lock_for_write() noexcept
{
if (!readers && !exclusively_used) {
- if (greedy || waiters.empty()) {
+ if (waiters.empty()) {
++writers;
return true;
}
}
// for shared writers
- seastar::future<> lock_for_write(bool greedy);
- bool try_lock_for_write(bool greedy) noexcept;
+ seastar::future<> lock_for_write();
+ bool try_lock_for_write() noexcept;
void unlock_for_write();
void promote_from_write();
void demote_to_write();