is there a way to have a init function that is called for every thread the task scheduler creates? I am trying to use TBB with OpenSG which has something called aspects where each thread gets its own aspect. However, this also requires me to set the correct aspect for each thread to work with. Calling this in the operator() is not really an option since it causes massive slowdowns.
The only idea I came up with so far was to create a dummy parallel-for that does nothing else but initilizing a thread but I am not shure how I can assure that every thread is used for the parallel-for.
Does anybody have an idea? Maybe for a future version of tbb the task_scheduler could take a callback-function that is called for each thread during initilization?!