- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Hello~
I am trying to understand the allocate_continuation source code lately.
It seems that it simply call the allocate_task to allocate a new task entity and return it.
However, the continuation task is not inserted into the task pool or mailbox via the spawn() function.
My question is, would TBB put the continuation task into the task pool?
If the continuation task's affinity id is not zero, would TBB put this task into the mailbox?
Any help would be grateful!
Dennis
Link Copied
4 Replies
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
"Any help would be grateful!"
What documentation have you consulted?
Basically, a continuation is implicitly spawned when "its" children finish executing. I have not yet looked into the affinity issues.
What documentation have you consulted?
Basically, a continuation is implicitly spawned when "its" children finish executing. I have not yet looked into the affinity issues.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - irisshinra308
My question is, would TBB put the continuation task into the task pool?
If the continuation task's affinity id is not zero, would TBB put this task into the mailbox?
As Raf correctly noted, a continuation task should be executed when its children completed. The thread that executed the "last" child (which means, decremented reference counter to 0) will either execute the continuation or spawn it to the own pool, depending on whether it has another task to execute "at hands". Most likely, the continuation task will be executed directly. But in case it does go to the pool, usual task-to-thread affinity rules are applied.
Also note that all this is the current implementation detail and may change.
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Quoting - Alexey Kukanov (Intel)
The thread that executed the "last" child (which means, decremented reference counter to 0) will either execute the continuation or spawn it to the own pool, depending on whether it has another task to execute "at hands". Most likely, the continuation task will be executed directly. But in case it does go to the pool, usual task-to-thread affinity rules are applied.
Thanks for the reply.
In most cases, a continuation task would be executed directly after the last child execution, but in some other cases, it could be put into the task pool and mailbox if needed. Am I right?
I thought this might be implemented in the wait_for_all(), and it seems that the switch case task::executing internally spawned the continuation task, right?
Thanks again
Dennis
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Apparently not a basic question after all... But why do you want to know this? BTW, a related question could be what happens if one of the children returns a pointer to the continuation.
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