Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.

Adding Condition Variables to tbb::thread

AJ13
New Contributor I
531 Views
I'm not sure if condition variables are part of C++0x's thread interface, or if condition variables (like in pthreads) are even portable to non-posix systems.

However, condition variables would be useful in tbb::thread for times when there is no useful work to do (until something happens). Are there any objections to adding condition variables to tbb::thread? This is something I would do myself and look at contributing.

AJ
0 Kudos
4 Replies
RafSchietekat
Valued Contributor III
531 Views
There is a proposal for std::condition_variable in N2800 (POSIX is just an API, without a monopoly on basic concepts).

Making such an implementation should be healthy exercise, but what would be truly exciting is a grand unification with the task-based approach.
0 Kudos
Dmitry_Vyukov
Valued Contributor I
531 Views
Quoting - AJ
I'm not sure if condition variables are part of C++0x's thread interface, or if condition variables (like in pthreads) are even portable to non-posix systems.

However, condition variables would be useful in tbb::thread for times when there is no useful work to do (until something happens). Are there any objections to adding condition variables to tbb::thread? This is something I would do myself and look at contributing.


Since there is a tbb_thread, there must be a condition variable too...
How are you going to implement condition variable under Windows prior to Vista?

0 Kudos
AJ13
New Contributor I
531 Views
I am only familiar with posix systems, so I wouldn't know how to implement condition variables on a non-posix system. Boost thread appears to have condition variables, so there may be some insight there.
0 Kudos
Dmitry_Vyukov
Valued Contributor I
531 Views
Quoting - AJ
I am only familiar with posix systems, so I wouldn't know how to implement condition variables on a non-posix system. Boost thread appears to have condition variables, so there may be some insight there.

I've already submitted my eventcount proposal, so now portable low-overhead condition variable can be implemented as simple as:
http://software.intel.com/en-us/forums/showpost.php?p=72257
0 Kudos
Reply