Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2421 Discussions

Are condition variables officially supported?

christian_conveygmai
127 Views

Hi guys,

Can anyone tell me what's going on with TBB support for condition variables?

I'm developing an app that is using TBB for multi-tasking, and I need condition variables.  I found an article here:  http://software.intel.com/en-us/blogs/2010/10/01/condition-variable-support-in-intel-threading-building-blocks suggesting that they're supported by TBB.  

But the condition_variable header file is burried in the "compat" subdirectory, and it doesn't show up in the HTML docs for TBB 4.0 (update 1).  That makes me wonder if the condition_variable class is going away soon, or is in some other way unsupported.

Is the idea that TBB really wants me to be using C++11's condtion_variable class, and this is just a nicety for compilers which don't yet support that part of C++11?  

0 Kudos
3 Replies
RafSchietekat
Black Belt
127 Views

Is the idea that TBB really wants me to be using C++11's condtion_variable class, and this is just a nicety for compilers which don't yet support that part of C++11?

Yes. Note that the class is not used by anything else in TBB (4.1 update 2), and that blocking on a mutex should be avoided inside a TBB task (blocking leads to undersubscription or worse), where a dummy_task dependency may be an appropriate replacement for a condition_variable.

christian_conveygmai
127 Views

Okay, thanks.  Apparently I'm not as up on C++11 features as I should have been, or else I would have noticed the the concurrency constructs in Boost and TBB were basically drop-in replacements for those in C++11.

RafSchietekat
Black Belt
127 Views

My impression is that boost often leads new standard functionality.

Reply