summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
-rw-r--r--fnet/src/vespa/fnet/frt/invoker.cpp19
-rw-r--r--fnet/src/vespa/fnet/frt/invoker.h6
2 files changed, 14 insertions, 11 deletions
diff --git a/fnet/src/vespa/fnet/frt/invoker.cpp b/fnet/src/vespa/fnet/frt/invoker.cpp
index 0cb364935df..5afc355c68f 100644
--- a/fnet/src/vespa/fnet/frt/invoker.cpp
+++ b/fnet/src/vespa/fnet/frt/invoker.cpp
@@ -8,7 +8,8 @@
LOG_SETUP(".fnet.frt.invoker");
FRT_SingleReqWait::FRT_SingleReqWait()
- : _cond(),
+ : _lock(),
+ _cond(),
_done(false),
_waiting(false)
{ }
@@ -18,12 +19,12 @@ FRT_SingleReqWait::~FRT_SingleReqWait() {}
void
FRT_SingleReqWait::WaitReq()
{
- _cond.Lock();
+ std::unique_lock<std::mutex> guard(_lock);
_waiting = true;
- while(!_done)
- _cond.Wait();
+ while(!_done) {
+ _cond.wait(guard);
+ }
_waiting = false;
- _cond.Unlock();
}
@@ -31,11 +32,11 @@ void
FRT_SingleReqWait::RequestDone(FRT_RPCRequest *req)
{
(void) req;
- _cond.Lock();
+ std::unique_lock<std::mutex> guard(_lock);
_done = true;
- if (_waiting)
- _cond.Signal();
- _cond.Unlock();
+ if (_waiting) {
+ _cond.notify_one();
+ }
}
diff --git a/fnet/src/vespa/fnet/frt/invoker.h b/fnet/src/vespa/fnet/frt/invoker.h
index 7716430f842..15d74017200 100644
--- a/fnet/src/vespa/fnet/frt/invoker.h
+++ b/fnet/src/vespa/fnet/frt/invoker.h
@@ -5,8 +5,9 @@
#include "rpcrequest.h"
#include <vespa/fnet/task.h>
#include <vespa/fnet/ipackethandler.h>
-#include <vespa/fastos/cond.h>
#include <vespa/fastos/thread.h>
+#include <mutex>
+#include <condition_variable>
class FRT_Method;
class FRT_Supervisor;
@@ -29,7 +30,8 @@ public:
class FRT_SingleReqWait : public FRT_IRequestWait
{
private:
- FastOS_Cond _cond;
+ std::mutex _lock;
+ std::condition_variable _cond;
bool _done;
bool _waiting;