File: barrier.qbk

package info (click to toggle)
boost1.35 1.35.0-5
  • links: PTS
  • area: main
  • in suites: lenny
  • size: 203,856 kB
  • ctags: 337,867
  • sloc: cpp: 938,683; xml: 56,847; ansic: 41,589; python: 18,999; sh: 11,566; makefile: 664; perl: 494; yacc: 456; asm: 353; csh: 6
file content (65 lines) | stat: -rw-r--r-- 1,460 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
[section:barriers Barriers]

A barrier is a simple concept. Also known as a ['rendezvous], it is a synchronization point between multiple threads. The barrier is
configured for a particular number of threads (`n`), and as threads reach the barrier they must wait until all `n` threads have
arrived. Once the `n`-th thread has reached the barrier, all the waiting threads can proceed, and the barrier is reset.

[section:barrier Class `barrier`]

    #include <boost/thread/barrier.hpp>

    class barrier
    {
    public:
        barrier(unsigned int count);
        ~barrier();

        bool wait();
    };

Instances of __barrier__ are not copyable or movable.

[heading Constructor]

    barrier(unsigned int count);

[variablelist

[[Effects:] [Construct a barrier for `count` threads.]]

[[Throws:] [__thread_resource_error__ if an error occurs.]]

]

[heading Destructor]

    ~barrier();

[variablelist

[[Precondition:] [No threads are waiting on `*this`.]]

[[Effects:] [Destroys `*this`.]]

[[Throws:] [Nothing.]]

]

[heading Member function `wait`]

    bool wait();

[variablelist

[[Effects:] [Block until `count` threads have called `wait` on `*this`. When the `count`-th thread calls `wait`, all waiting threads
are unblocked, and the barrier is reset. ]]

[[Returns:] [`true` for exactly one thread from each batch of waiting threads, `false` otherwise.]]

[[Throws:] [__thread_resource_error__ if an error occurs.]]

]

[endsect]

[endsect]