- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
tasks are created and properly executed, for N iterations of the task is not execute.
no exceptions.
what could be the problem? how to get the error?
class MyTask: public tbb::task
{
Function _f; //boost::function <void (tbb::task *)>
public:
MyTask(Function f) : _f(f) {}
~MyTask() {}
tbb::task * execute()
{
set_ref_count(1);
_f(this);
wait_for_all();
}
static Run(Function f)
{
MyTask& t = *new(allocate_root())t(f);
tbb::task::spawn(t);
}
}
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Sergey M. wrote:Did you run it in debug configuration? It prints diagnostics if ref_count is misused (in _f).
tbb::task * execute()
{
set_ref_count(1);
_f(this);
wait_for_all();
}
static Run(Function f)
{
MyTask& t = *new(allocate_root())t(f);
tbb::task::spawn(t);
}
}
The problem with non-executing tasks relates likely to missed wake-ups (e.g. as described here: http://software.intel.com/en-us/forums/topic/302353). And basically, it arises from the fact that you don't call required wait_for_all() after spawn().
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