| Thread Tools | Search this thread |
|---|
sagnak
| July 10, 2009 1:05 PM PDT A newbie question regarding parallel_while knockoff and tbb::task::self() | ||||
I was revisiting a code which had a parallel_while and wanted to do same thing explicitly instead of using parallel_while (since that being deprecated). What I understood from the source for parallel_while is that it creates an empty task and makes every new task a child of that root empty task and waits on the root, which acts like a barrier. In my code to achieve the same, I have created a root empty task, generated by the master thread. Then, I allow multiple threads to create new tasks and add it as a child to the root. When I want to join, I wait on the root empty task. This works fine, however I am having trouble understanding why, my assumption would be that it should not have. Let me elaborate my confusion below. Now when a thread wants to add a new child to the root, it needs a running task on that thread to do so (if I am not mistaken). My question is: How does a thread make a task an additional child of the root before starting running a task? When an initialize the task scheduler every thread should have null for tbb::task::self() (The master thread is running but since what it is doing is not a tbb::task, self() should be null for that, too). If that is the case, how is the very first job start executing? Sagnak | |||||
|
|||||||||||||
|
|||||||||||||
| 8285 users have contributed to 31229 threads and 99107 posts to date. |
|---|
| In the past 24 hours, we have 9 new thread(s) 39 new posts(s), and 55 new user(s). In the past 3 days, the most popular thread for everyone has been comparison cilk++, openmp, pthreads first results The most posts were made to comparison cilk++, openmp, pthreads first results The post with the most views is Very amusing... Escalated as Please welcome our newest member tvinni |