mirror of
https://github.com/matrix-construct/construct
synced 2025-01-14 00:34:18 +01:00
ircd::ctx: Add additional shared_mutex timed functionality.
This commit is contained in:
parent
fe45b08f8a
commit
67e6c63580
1 changed files with 26 additions and 6 deletions
|
@ -298,18 +298,38 @@ ircd::ctx::shared_mutex::try_lock_for(duration&& d)
|
|||
|
||||
template<class time_point>
|
||||
bool
|
||||
ircd::ctx::shared_mutex::try_lock_upgrade_until(time_point&& d)
|
||||
ircd::ctx::shared_mutex::try_lock_upgrade_until(time_point&& tp)
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
const bool can_lock_upgrade
|
||||
{
|
||||
q.wait_until(tp, [this]
|
||||
{
|
||||
return this->can_lock_upgrade();
|
||||
})
|
||||
};
|
||||
|
||||
if(can_lock_upgrade)
|
||||
u = true;
|
||||
|
||||
return can_lock_upgrade;
|
||||
}
|
||||
|
||||
template<class time_point>
|
||||
bool
|
||||
ircd::ctx::shared_mutex::try_lock_shared_until(time_point&& d)
|
||||
ircd::ctx::shared_mutex::try_lock_shared_until(time_point&& tp)
|
||||
{
|
||||
assert(0);
|
||||
return false;
|
||||
const bool can_lock_shared
|
||||
{
|
||||
q.wait_until(tp, [this]
|
||||
{
|
||||
return this->can_lock_shared();
|
||||
})
|
||||
};
|
||||
|
||||
if(can_lock_shared)
|
||||
++s;
|
||||
|
||||
return can_lock_shared;
|
||||
}
|
||||
|
||||
template<class time_point>
|
||||
|
|
Loading…
Reference in a new issue