You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
The examples often use std::cout inside tasks, and the output can get pretty jumbled.
For example, fig_3_03 output of
std::cout << "first node received: " << in << std::endl;
I've been changing these to, for example
`
std::stringstream ss;
ss << "first node received: " << in << std::endl;
std::cout << ss.str();
`
This seems to work, although it isn't clear to me that even it is guaranteed.
So, I'm adding a cout_locked function that should be guaranteed in my examples
The examples often use std::cout inside tasks, and the output can get pretty jumbled.
For example, fig_3_03 output of
std::cout << "first node received: " << in << std::endl;
I've been changing these to, for example
`
std::stringstream ss;
`
This seems to work, although it isn't clear to me that even it is guaranteed.
So, I'm adding a cout_locked function that should be guaranteed in my examples
`
tbb::spin_mutex mylock;
void cout_locked(const std::string &ss)
{
}
`
and so the code above becomes
`
std::stringstream ss;
`
The problem with the current output is easy to see if the fig_3_03 example is modified to send more messages in the test
`
// step 4: send messages
for (int i=0;i<100;i++)
my_first_node.try_put(i);
`
The text was updated successfully, but these errors were encountered: