Permalink
Browse files

Fix segfault when using TBB from code in command runner

  • Loading branch information...
ypnos committed Jun 4, 2016
1 parent 5938fe7 commit 9738c007075a1474612a0878b72799c028d605ee
Showing with 7 additions and 3 deletions.
  1. +0 −3 core/background_task/background_task_queue.cpp
  2. +7 −0 gui/app/gerbilapplication.cpp
@@ -11,7 +11,6 @@
//#define BACKGROUND_TASK_QUEUE_DEBUG
#include "background_task_queue.h"
-#include <tbb/task_scheduler_init.h>
#include <iostream>
#include <iomanip>
@@ -95,8 +94,6 @@ void BackgroundTaskQueue::operator()()
#else
{
#endif
- // use for debugging, only one thread
- // tbb::task_scheduler_init init(1);
while (true) {
if (!pop()) {
break; // Thread termination.
@@ -11,6 +11,8 @@
#include <QStringList>
#include <QMessageBox>
+#include <tbb/task_scheduler_init.h>
+
#include <iostream>
#include <string>
@@ -19,6 +21,11 @@
int main(int argc, char **argv)
{
+ /* ensure global tbb task scheduler for process lifetime
+ * avoid problems with tbb tasks started from different threads
+ */
+ tbb::task_scheduler_init tsi; // for debugging pass 1 -> only one thread
+
return GerbilApplication(argc, argv).exec();
}

0 comments on commit 9738c00

Please sign in to comment.