Link Copied
In fact, the flow graph has also support for control flow, which is your case. I think it should actually work for you; consider giving it a try.
The TBB tasks were designed, and evolved incrementally since that, as the low-level mechanism for efficient implementation of high-level constructions: parallel algorithms, and recently the flow graph. Later we added the functions to directly manipulate the task reference counter; it was absent when the TBB book was written. The example was added to the tutorial at the time the functionality was added, or soon after (as far as I can tell, it's the revision 1.15 dated August 2009; and of course the API is mentioned in the Reference since the same time. So, while theremight becases where the documentation is insufficient, I do not think this is one of these cases.
As for running into problems when you use the API in a non-documented way, why exactly is it a surprise to you, and why you think it's"not nice"? The documentation describes how the library is intended to be used; if you go beyond that, you always certainly step into some grey area, perhaps relying on non-documented features that may change. Or do I misinterpret your words somehow?
Anyway, thanks for your opinion. If you can point to specific functionality that in your opinion is not documented enough, or have other suggestions of what can be improved, please tell us, and we will try to do better.
For more complete information about compiler optimizations, see our Optimization Notice.