2
0
mirror of https://github.com/boostorg/thread.git synced 2026-01-24 06:22:12 +00:00

Merge of new boost.thread code along with required changes from boost.bind

[SVN r46474]
This commit is contained in:
Anthony Williams
2008-06-18 13:01:08 +00:00
parent 525d190f91
commit 60fdcddcb5
62 changed files with 4231 additions and 1487 deletions

View File

@@ -46,11 +46,16 @@ private:
bounded_buffer buf(2);
boost::mutex io_mutex;
void sender() {
int n = 0;
while (n < 100) {
buf.send(n);
std::cout << "sent: " << n << std::endl;
{
boost::mutex::scoped_lock io_lock(io_mutex);
std::cout << "sent: " << n << std::endl;
}
++n;
}
buf.send(-1);
@@ -60,7 +65,10 @@ void receiver() {
int n;
do {
n = buf.receive();
std::cout << "received: " << n << std::endl;
{
boost::mutex::scoped_lock io_lock(io_mutex);
std::cout << "received: " << n << std::endl;
}
} while (n != -1); // -1 indicates end of buffer
}