1
Different from the class tt(condition_variable) the class
2
ti(condition_variable_any) can be used with any (e.g., user-supplied) lock
3
type, and not just with the stl-provided tt(unique_lock<mutex>).
5
Before using the class tt(condition_variable_any) the tthi(condition_variable)
6
header file must have been included.
8
The functionality that is offered by tt(condition_variable_any) is identical
9
to the functionality offered by the class tt(condition_variable), albeit that
10
the lock-type that is used by tt(condition_variable_any) is not
11
predefined. The class tt(condition_variable_any) requires specification of the
12
lock-type that must be used by its objects.
14
In the interface shown below this lock-type is referred to as ti(Lock). Most
15
of tt(condition_variable_any's) members are defined as member templates,
16
defining a tt(Lock) type as one of its parameters. The requirements of these
17
lock-types are identical to those of the stl-provided tt(unique_lock), and
18
user-defined lock-type implementations should provide at least the interface
19
and semantics that is also provided by tt(unique_lock).
21
This section merely presents the interface of the class
22
tt(condition_variable_any). As its interface offers the same members as
23
tt(condition_variable) (allowing, where applicable, passing any lock-type
24
instead of just tt(unique_lock) to corresponding members), the reader is
25
referred to the previous section for a description of the semantics of the
28
Like tt(condition_variable), the class tt(condition_variable_any) merely
29
offers a default constructor. No copy constructor or overloaded assignment
30
operator are provided.
32
Also, like tt(condition_variable), the class's destructor requires that no
33
thread is blocked by the current thread. This implies that all other (waiting)
34
threads must have been notified; those threads may, however, subsequently
35
block on the lock specified in their tt(wait) calls.
37
Note that, in addition to tt(Lock), the types tt(Clock, Duration, Period,
38
Predicate,) and tt(Rep) are template types, defined just like the identically
39
named types mentioned in the previous section.
41
The class tt(condition_variable_any's) members are:
44
itht(notify_one)(void notify_one() noexcept;)
45
itht(notify_all)(void notify_all() noexcept;)
46
itht(wait)(void wait(Lock& lock);)
47
itt(void wait(Lock& lock, Predicate pred);)
48
itht(wait_until)(cv_status wait_until(Lock& lock, const
49
chrono::time_point<Clock, Duration>& absTime);)
50
itt(bool wait_until(Lock& lock, const chrono::time_point<Clock, Duration>&
51
absTime, Predicate pred);)
52
itht(wait_for)(cv_status wait_for(Lock& lock, const chrono::duration<Rep,
54
itt(bool wait_for(Lock& lock, const chrono::duration<Rep, Period>&
55
relTime,))linebreak() tt(Predicate pred);