Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[TRIVIAL] Remove all uses of the name scoped_lock #3309

Closed
wants to merge 1 commit into from
Closed
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 3 additions & 5 deletions src/ripple/core/impl/semaphore.h
Original file line number Diff line number Diff line change
Expand Up @@ -29,8 +29,6 @@ template <class Mutex, class CondVar>
class basic_semaphore
{
private:
using scoped_lock = std::unique_lock <Mutex>;

Mutex m_mutex;
CondVar m_cond;
std::size_t m_count;
Expand All @@ -49,15 +47,15 @@ class basic_semaphore
/** Increment the count and unblock one waiting thread. */
void notify ()
{
scoped_lock lock (m_mutex);
std::lock_guard lock{m_mutex};
++m_count;
m_cond.notify_one ();
}

/** Block until notify is called. */
void wait ()
{
scoped_lock lock (m_mutex);
std::unique_lock lock{m_mutex};
while (m_count == 0)
m_cond.wait (lock);
--m_count;
Expand All @@ -68,7 +66,7 @@ class basic_semaphore
*/
bool try_wait ()
{
scoped_lock lock (m_mutex);
std::lock_guard lock{m_mutex};
if (m_count == 0)
return false;
--m_count;
Expand Down