CppCommon
1.0.5.0
C++ Common Library
Loading...
Searching...
No Matches
include
threads
named_condition_variable.inl
Go to the documentation of this file.
1
9
namespace
CppCommon
{
10
11
template
<
typename
TPredicate>
12
void
NamedConditionVariable::Wait
(TPredicate predicate)
13
{
14
while
(!predicate())
15
Wait
();
16
}
17
18
template
<
typename
TPredicate>
19
bool
NamedConditionVariable::TryWaitFor
(
const
Timespan
& timespan, TPredicate predicate)
20
{
21
Timestamp
timeout =
UtcTimestamp
() + timespan;
22
while
(!predicate())
23
if
(!
TryWaitFor
(timeout -
UtcTimestamp
()))
24
return
predicate();
25
return
true
;
26
}
27
28
}
// namespace CppCommon
CppCommon::NamedConditionVariable::Wait
void Wait()
Wait until condition variable is notified.
Definition
named_condition_variable.cpp:265
CppCommon::NamedConditionVariable::TryWaitFor
bool TryWaitFor(const Timespan ×pan)
Try to wait for the given timespan until condition variable is notified.
Definition
named_condition_variable.cpp:267
CppCommon::Timespan
Timespan.
Definition
timespan.h:27
CppCommon::Timestamp
Timestamp.
Definition
timestamp.h:30
CppCommon::UtcTimestamp
UTC timestamp.
Definition
timestamp.h:248
CppCommon
C++ Common project definitions.
Definition
token_bucket.h:15
Generated by
1.9.8