Intel® oneAPI Threading Building Blocks
Ask questions and share information about adding parallelism to your applications when using this threading library.
Announcements
This community is designed for sharing of public information. Please do not share Intel or third-party confidential information here.
2417 Discussions

Initialization of 'task_scheduler_init' in multiple threads

_anveena
Beginner
140 Views
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
0 Kudos
0 Replies
Reply