- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi!
My program must have 3 threads which working during whole programs life in parallel. They must communicate each other. What is the best pattern for this? task:enqueue?
Something like this:
LongTask* t = new (tbb::task::allocate_root())LongTask();
My program must have 3 threads which working during whole programs life in parallel. They must communicate each other. What is the best pattern for this? task:enqueue?
Something like this:
LongTask* t = new (tbb::task::allocate_root())LongTask();
LongTask* t1 = new (tbb::task::allocate_root())LongTask();
LongTask* t2 = new (tbb::task::allocate_root())LongTask();
tbb::task:enqueue(*t);
tbb::task:enqueue(*t1);
tbb::task:enqueue(*t2);
Link Copied
2 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
As I understand boost::thread is more suitable in this case because TBB is not guarantee that tasks will run in parallel. But Is it possible to use boost::thread to create threads and tbb concurent containers, tbb sync primitives for use in that boost threads?
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"As I understand boost::thread is more suitable in this case because TBB
is not guarantee that tasks will run in parallel."
Correct.
"But Is it possible to use boost::thread to create threads and tbb concurent containers, tbb sync primitives for use in that boost threads?"
Any API to create threads will do (TBB even has its own in anticipation of the latest standard C++ if your compiler does not provide that yet), and you don't even have to make a choice; TBB's other features should work regardless of how the threads were created.
Correct.
"But Is it possible to use boost::thread to create threads and tbb concurent containers, tbb sync primitives for use in that boost threads?"
Any API to create threads will do (TBB even has its own in anticipation of the latest standard C++ if your compiler does not provide that yet), and you don't even have to make a choice; TBB's other features should work regardless of how the threads were created.
Reply
Topic Options
- Subscribe to RSS Feed
- Mark Topic as New
- Mark Topic as Read
- Float this Topic for Current User
- Bookmark
- Subscribe
- Printer Friendly Page