Opened 15 years ago

Closed 15 years ago

#1657 closed Bugs (fixed)

Bug in boost::threads sample

Reported by: morehate@… Owned by: Anthony Williams
Milestone: Boost 1.36.0 Component: threads
Version: Boost 1.34.1 Severity: Cosmetic
Keywords: example Cc:

Description

Good day.

Boost::threads has example "conditions.cpp" in boost\libs\thread\example folder.

This sample has problems with synchronyzation between output streams:

void sender() {
...
        std::cout << "sent: " << n << std::endl; // <-- There isn't synchronyzation
...
}
void receiver() {
...
        std::cout << "received: " << n << std::endl;  // <-- There isn't synchronyzation
...
}

So the result of this sample looks like this:

received: 96
received: sent: 97 // <--
sent: 98
sent: 99
97 // <--
received: 98

I think this is very strange for multithreads synchronization sample ;).

Change History (1)

comment:1 by Anthony Williams, 15 years ago

Resolution: fixed
Status: newclosed
Note: See TracTickets for help on using tickets.