- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hi there,
I am using TBB 4.1 in production and I have recently came across a problem that *seems* to indicate that on occasion tasks can be dropped without every being executed. I am using the following call to spawn a task:
auto &task = *new(tbb::task::allocate_root()) DrainMailbox(*me, this); LOG << "Spawning " << &task; tbb::task::spawn(task);
And inside the task I log as follows:
struct TBBMailbox::DrainMailbox : public tbb::task { DrainMailbox (TBBMailbox::PImpl &me, TBBMailbox const *ptr) : me (me), mbox_ptr (ptr) {} tbb::task* execute () { LOG << " task: " << this << " executing";
...
On occasion I see the "spawn" log entry but not the corresponding "executing" log entry (other tasks are still being spawned and executed - so I know TBB has enough non blocked threads to work with).
Any ideas on what could be going wrong? This is in on Linux x64, 3.13.
Thanks in advance
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
If you want to "fire and forget" a task, use enqueue() rather than spawn(). Otherwise you could explicitly spawn_root_and_wait().
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