diff options
author | Tor Egge <Tor.Egge@oath.com> | 2017-10-27 12:50:07 +0000 |
---|---|---|
committer | Tor Egge <Tor.Egge@oath.com> | 2017-10-27 12:50:07 +0000 |
commit | f4e904b05e7c1fd9d4cda3ace693b41912ac6622 (patch) | |
tree | ba5425a875ed6bfaada08971d3bb9c7a06bc37c8 /fnet/src/tests/frt/rpc/session.cpp | |
parent | bfac5e28b274bf613728549c5dd4b597bd29a167 (diff) |
Use std::mutex and std::condition_variable instead of FastOS_Cond
in fnet unit tests.
Diffstat (limited to 'fnet/src/tests/frt/rpc/session.cpp')
-rw-r--r-- | fnet/src/tests/frt/rpc/session.cpp | 15 |
1 files changed, 7 insertions, 8 deletions
diff --git a/fnet/src/tests/frt/rpc/session.cpp b/fnet/src/tests/frt/rpc/session.cpp index 0316129a8b5..2e920ac9f98 100644 --- a/fnet/src/tests/frt/rpc/session.cpp +++ b/fnet/src/tests/frt/rpc/session.cpp @@ -2,28 +2,27 @@ #include <vespa/vespalib/testkit/test_kit.h> #include <vespa/fnet/frt/frt.h> +#include <mutex> class Session { private: - static FastOS_Mutex _lock; + static std::mutex _lock; static int _cnt; int _val; public: Session() : _val(0) { - _lock.Lock(); - ++_cnt; - _lock.Unlock(); + std::lock_guard<std::mutex> guard(_lock); + ++_cnt; } ~Session() { - _lock.Lock(); - --_cnt; - _lock.Unlock(); + std::lock_guard<std::mutex> guard(_lock); + --_cnt; } void SetValue(int val) { _val = val; } @@ -31,7 +30,7 @@ public: static int GetCnt() { return _cnt; } }; -FastOS_Mutex Session::_lock; +std::mutex Session::_lock; int Session::_cnt(0); |