~ubuntu-branches/ubuntu/trusty/c++-annotations/trusty-proposed

« back to all changes in this revision

Viewing changes to yo/stl/conditionany.yo

  • Committer: Package Import Robot
  • Author(s): Frank B. Brokken
  • Date: 2013-05-30 13:32:18 UTC
  • mfrom: (1.1.24)
  • Revision ID: package-import@ubuntu.com-20130530133218-k39mr5uredd093jr
Tags: 9.7.2-1
New upstream release, repairs several minor left-over flaws.
This release incorporates 9.7.0 and 9.7.1.

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
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>). 
 
4
 
 
5
Before using the class tt(condition_variable_any) the tthi(condition_variable)
 
6
header file must have been included.
 
7
 
 
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. 
 
13
 
 
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).
 
20
 
 
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
 
26
class members.
 
27
 
 
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.
 
31
 
 
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.
 
36
 
 
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.
 
40
 
 
41
The class tt(condition_variable_any's) members are:
 
42
 
 
43
    itemization(
 
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,
 
53
        Period>& relTime);) 
 
54
    itt(bool wait_for(Lock& lock, const chrono::duration<Rep, Period>&
 
55
        relTime,))linebreak() tt(Predicate pred); 
 
56
    )
 
57
 
 
58
 
 
59
 
 
60