- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
I'm using Windows 10 64bit with TBB 2018 Update 2.
I have 2 tbb::task
s:
struct QueueProcessingTask : public tbb::task
{
QueueProcessingTask();
~QueueProcessingTask();
task *execute();
};
struct MainScanTask : public tbb::task
{
MainScanTask();
~MainScanTask();
task *execute();
QueueProcessingTask *m_pTask;
};
In my main manager object I have an instance of
MainScanTask *m_mainTask;
And I'm calling
m_mainTask = new(tbb::task::allocate_root()) MainScanTask();
m_mainTask->execute();
where execute
is
tbb::task *MainScanTask::execute()
{
m_pTask = new(allocate_continuation())QueueProcessingTask();
if (!m_pTask)
{
Trace("allocate_continuation() failed");
return NULL;
}
QueueProcessingTask& task1 = *m_pTask;
Trace("Spawning");
spawn(task1);
Trace("Spawned");
return m_pTask;
}
This part works well. However, once in a while (could be every 10 runs, or could be every 1000 runs), the call to spawn(task1)
doesn't seems to call QueueProcessingTask
's execute()
and therefor causes an access violation on later parts of the run.
I have log prints in which are sometimes not being printed
tbb::task *QueueProcessingTask::execute()
{
Trace("QueueProcessingTask::execute() 1");
RunPipeLine(); // Launches tbb::pipeline
Trace("QueueProcessingTask::execute() 2");
return NULL;
}
My questions are:
- Why? is there a better way of implementing such mechanism
- Can I detect such situation and maybe try and spawn again?
Link Copied
1 Reply
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Could you explain, what mechanism you are trying to implement, please?
P.S. spawn never calls the execute method, it just publishes the task to be processed by a worker thread.

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