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

Could you supply some basic components in tbb, so make tbb can replace pthread llibrary.

ahfuqq_com
Beginner
178 Views
Hi, greate tbb engineers,
I have a question: Why don't you supply some basic components in tbb,
such as some kind of classes to envelop pthread_t, pthread_metux_t, pthread_cond_t, pthread_barrier_t, pthread_rwlock_t... and so on.
If there are those classes, I can use tbb to replace pthread library.

I already found I can use tbb::metux to replace pthread_metux_t,
use tbb::spin_metux to replace pthread_spinlock_t.
But didn't found others.

Thanks, and sorry about my poor English.

From a China guy, Ahfu
0 Kudos
1 Reply
RafSchietekat
Valued Contributor III
178 Views
An ancient joke about C++ was that the language is called C++ and not ++C because the language is improved (incremented), but many people still use it as C (the previous value).- H. Sutter, A. Alexandrescu, C++ Coding Standards

Have a look at tbb_thread and {spin,queuing}_rw_mutex. Condition variables and barriers do not really fit TBB, which has a higher-level approach to multithreading. If you have legacy code, you might as well leave them where they are, for now; for new code, try to embrace TBB's concepts instead. Of course, somebody could still decide to include some such objects ahead of C++0x, like with tbb_thread... maybe they already exist ("AJ"?).
0 Kudos
Reply