0
0
Fork 0
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:
Jason Volk 2018-11-13 18:22:11 -08:00
parent fe45b08f8a
commit 67e6c63580

View file

@ -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>