tbb::task::spawn not execute

tbb::task::spawn not execute

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);
}

2 post / 0 nuovi
Ultimo contenuto
Per informazioni complete sulle ottimizzazioni del compilatore, consultare l'Avviso sull'ottimizzazione

Citazione:

Sergey M. ha scritto:

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);
}

Did you run it in debug configuration? It prints diagnostics if ref_count is misused (in _f).
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().

Lascia un commento

Eseguire l'accesso per aggiungere un commento. Non siete membri? Iscriviti oggi