0
0
Fork 0
mirror of https://github.com/matrix-construct/construct synced 2025-02-18 01:30:12 +01:00

ircd::util: Add an unlock_guard.

This commit is contained in:
Jason Volk 2017-09-29 14:01:43 -07:00
parent 6dfe034f6f
commit 90f9c0e39d

View file

@ -1116,5 +1116,23 @@ ctype(const char *begin,
}
template<class lockable>
struct unlock_guard
{
lockable &l;
unlock_guard(lockable &l)
:l{l}
{
l.unlock();
}
~unlock_guard() noexcept
{
l.lock();
}
};
} // namespace util
} // namespace ircd