Is there blog post or other information regarding the new task_arena class currently in the community preview? I've read the docs on this but still unsure of the use cases surrounding it.
We've encountered serious problems in using legacy code with TBB. Say we have some tasks spawned which call function A(). A() locks a shared resource and then calls into other code that spawns more tasks. Due to the task stealing nature of TBB's scheduler, the worker thread that has A() on its stack may steal a task that runs A(). This causes a deadlock because A() has not finished yet, and can't because it is stuck earlier in the stack. (I think an example of this was discussed by Arch Robison in an old forum thread, except that the "graph" ends up occuring implicitly through natural code execution.)
I wonder if task_arena might be employed to solve the above scenario. So when a resource is locked, we start all nested subtasks into a new task_arena. So in this way, we "protect" the the current worker thread that owns the lock from stealing tasks that may try to acquire the same lock. Rewriting the code to avoid this scenario is often very hard in legacy code since these situations are spread out over several generic libraries that depend on each other. It would be nice if there was an easy way in TBB to handle these situations.
Thanks in advance!