I'm developing a framework with C++, and it contains three layers:
- Low level functions which do the hard work
- An upper layer which uses the low level functions to accomplish tasks (functions at this level generally uses only one lower level function and explicitly accepts the pointer of the function to know which function to call)
- Top level classes which utilizes these middle layer functions to accomplish complete tasks.
The problem is, I'm introducing concurrency into the framework and need a way to tune this concurrency per function basis. I can design an object to transfer concurrency parameters, but I don't want to pass an object to functions which are not concurrent.
Concurrent functions can be at any level and their concurrency needs to be controlled independently.
Is there a better pattern or method to allow only concurrent functions to access this information?