]>
git.proxmox.com Git - ceph.git/blob - ceph/src/boost/libs/thread/tutorial/counter.cpp
1 // Copyright (C) 2001-2003
4 // Distributed under the Boost Software License, Version 1.0. (See accompanying
5 // file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
7 #include <boost/thread/mutex.hpp>
8 #include <boost/thread/thread.hpp>
16 boost::mutex::scoped_lock
lock(mutex
);
18 std::cout
<< "count == " << i
<< std::endl
;
23 const int num_threads
= 4;
24 boost::thread_group thrds
;
25 for (int i
=0; i
< num_threads
; ++i
)
26 thrds
.create_thread(&change_count
);