Initialization of 'task_scheduler_init' in multiple threads

Initialization of 'task_scheduler_init' in multiple threads

Hello,

Iam looking for more informationabout the initialization oftask_scheduler_init in multiple threads.

In my current programm, I use a 'TaskManager' class which calls once task_scheduler_init in the main thread.

main()
{
TaskManager *pTaskManager = new TaskManager; // Calls internally task_scheduler_init::initialize()
...
// Create a DLL
CreateDLL();
...
// Retrieve the function 'RunSystem'from the DLL via GetprocAdress("Run");

// Create a new TBB task anduse this new task to call 'Run' function
//This way 'RunSystem' runs in aDIFFERENT thread from this one.
}

I assume I passed to the function 'RunSystem' a pointer on pTaskManager like this :

TaskManager **ppPointerOnpTaskManager = &pTaskManager;

Now, in the function RunSystem, I call :

(*ppPointerOnpTaskManager)->DoSomethingUses_parallel_for();

My question is : will this force the DLL to create another task_scheduler_init, or will the one initialized IN (*pTaskManager) will be used ?

Best regards

1 post / 0 new
For more complete information about compiler optimizations, see our Optimization Notice.