diff options
author | Pixel <pixel@nobis-crew.org> | 2012-03-08 07:25:27 -0800 |
---|---|---|
committer | Pixel <pixel@nobis-crew.org> | 2012-03-08 07:46:59 -0800 |
commit | 2380ebca01bdff36c2d12b0a23bef84e07920cb3 (patch) | |
tree | 47dbc4523a2d6c61fed221fe4c67410fd107b2c4 /src/HttpServer.cc | |
parent | 85e533ca87fff1b7ab40bd87a3a44b6969eefd13 (diff) |
Adding the ScopeLock class to simplify a bit some pieces of code.
Diffstat (limited to 'src/HttpServer.cc')
-rw-r--r-- | src/HttpServer.cc | 10 |
1 files changed, 3 insertions, 7 deletions
diff --git a/src/HttpServer.cc b/src/HttpServer.cc index c596005..fe421b9 100644 --- a/src/HttpServer.cc +++ b/src/HttpServer.cc @@ -607,21 +607,19 @@ void Balau::HttpServer::stop() { } void Balau::HttpServer::registerAction(Action * action) { - m_actionsLock.enterW(); + ScopeLockW slw(m_actionsLock); action->ref(); m_actions.push_front(action); - m_actionsLock.leave(); } void Balau::HttpServer::flushAllActions() { - m_actionsLock.enterW(); + ScopeLockW slw(m_actionsLock); Action * a; while (!m_actions.empty()) { a = m_actions.front(); m_actions.pop_front(); a->unref(); } - m_actionsLock.leave(); } Balau::HttpServer::Action::ActionMatch Balau::HttpServer::Action::matches(const char * uri, const char * host) { @@ -636,7 +634,7 @@ Balau::HttpServer::Action::ActionMatch Balau::HttpServer::Action::matches(const } Balau::HttpServer::ActionFound Balau::HttpServer::findAction(const char * uri, const char * host) { - m_actionsLock.enterR(); + ScopeLockR slr(m_actionsLock); ActionList::iterator i; ActionFound r; @@ -653,8 +651,6 @@ Balau::HttpServer::ActionFound Balau::HttpServer::findAction(const char * uri, c else r.action->ref(); - m_actionsLock.leave(); - return r; } |