Ticket #2155: simpler.qbk

File simpler.qbk, 1.1 KB (added by Eric Niebler, 14 years ago)

a simpler qbk file that exhibits the problem

Line 
1[library Boost.Asio
2 [quickbook 1.4]
3 [copyright 2003 - 2008 Christopher M. Kohlhoff]
4 [license
5 Distributed under the Boost Software License, Version 1.0.
6 (See accompanying file LICENSE_1_0.txt or copy at
7 [@http://www.boost.org/LICENSE_1_0.txt])
8 ]
9 [category generic]
10]
11
12[section Timer.5]
13
14In a multithreaded program
15
16 ``''''''`` void print2()
17 ``''''''`` {
18 ``''''''`` if (count_ < 10)
19 ``''''''`` {
20 ``''''''`` std::cout << "Timer 2: " << count_ << "\n";
21 ``''''''`` ++count_;
22 ``''''''`` timer2_.expires_at(timer2_.expires_at() + boost::posix_time::seconds(1));
23 ``''''''`` timer2_.async_wait(strand_.wrap(boost::bind(&printer::print2, this)));
24
25Just as it would with a call from a single thread
26
27 ``''''''``int main()
28 ``''''''``{
29 ``''''''`` boost::asio::io_service io;
30 ``''''''`` printer p(io);
31 ``''''''`` boost::thread t(boost::bind(&boost::asio::io_service::run, &io));
32 ``''''''`` io.run();
33 ``''''''`` t.join();
34 ``''''''`` return 0;
35 ``''''''``}
36
37[endsect]