preCICE
v3.1.2
Loading...
Searching...
No Matches
src
com
SocketRequest.cpp
Go to the documentation of this file.
1
#include "
SocketRequest.hpp
"
2
3
namespace
precice::com
{
4
5
void
SocketRequest::complete
()
6
{
7
{
8
std::lock_guard<std::mutex>
lock(
_completeMutex
);
9
10
_complete
=
true
;
11
}
12
13
_completeCondition
.
notify_one
();
14
}
15
16
bool
SocketRequest::test
()
17
{
18
std::lock_guard<std::mutex>
lock(
_completeMutex
);
19
20
return
_complete
;
21
}
22
23
void
SocketRequest::wait
()
24
{
25
std::unique_lock<std::mutex>
lock(
_completeMutex
);
26
27
// Lock is acquired when the predicate is evaluated.
28
_completeCondition
.
wait
(lock, [
this
] {
return
_complete
; });
29
}
30
}
// namespace precice::com
SocketRequest.hpp
precice::com::SocketRequest::complete
void complete()
Definition
SocketRequest.cpp:5
precice::com::SocketRequest::_completeMutex
std::mutex _completeMutex
Definition
SocketRequest.hpp:20
precice::com::SocketRequest::wait
void wait() override
Definition
SocketRequest.cpp:23
precice::com::SocketRequest::_completeCondition
std::condition_variable _completeCondition
Definition
SocketRequest.hpp:19
precice::com::SocketRequest::_complete
bool _complete
Definition
SocketRequest.hpp:17
precice::com::SocketRequest::test
bool test() override
Definition
SocketRequest.cpp:16
std::lock_guard
precice::com
contains the data communication abstraction layer.
Definition
Communication.cpp:12
std::condition_variable::notify_one
T notify_one(T... args)
std::unique_lock
std::condition_variable::wait
T wait(T... args)