I have about 10 objects. Each object is different class. Requests sent to those objects (method calls with returning values) comes from different threads.
I need to synchronise those method calls, that only one must be executed at a time. Some requests have higher priority than the others. It means that if there are more requests waiting to be executed and another one is sent - with higher priority than any other waiting for execution, it shall be executed as next one.
I don't know how to solve this problem in C++. I was thinking about Command pattern but it would require a lot of "manual" coding. I would have to convert each method call into a command object. And the problem is with return value. Does anybody have an idea, what pattern can be used here?