- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I am new to Intel TBB. I am not clear on the purpose of setting a task's reference count to 3 while waiting on the 2 children to get executed.
My doubt is if the individual child tasks complete their execution and reduce the reference count by 1 . and eventually on the completion of the 2 child tasks the ref count now is zero and hence the parent/root can be executed. But what is the purpose to set it to 3?
PL correct me if my concept is wrong.
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
The extra reference is to protect the parent against being automatically spawned by a thread that just finished execution of the parent's last remaining child. The reference count thus integrates a conceptual pure reference count (only the child tasks) with a conceptual status field (automatically spawn after last child or not?) into one real atomic integer that makes sense if you think of the wait_for_all() or similar call as needing its own reference, which is also validated by a simpler implementation that merely selects an appropriate threshold (wait_for_all() returns when the reference count drops down to one, instead of zero).
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