I am sure that this is a common design pattern, but I seem to have a blind-spot.
I have a requirement that the function call from Application to Service be blocking, but service needs to do something asynchronous.
Well, I can handle that, BUT, there can be multiple applications and there is only one service.
While the service should block the application, it should also be able to handle multiple parallel requests from different applications.
I suppose I need to spawn a new thread for each application’s request, but how then can I return from the thread to application at the end?
I don't mind an assembler insert to store the application’s return address & pop it later, but is that really necessary?
Do I need to do anything special in C++ to mark the service function as re-entrant?
Can someone please lift my blindfold?
[Update] There is no correlation between the applications.
Also, only the service would be allowed to spawn a thread, not the applications. So, I am thinking of a
service main spawning a bunch of
service threads, but I don't see how I can can handle the function call blocking & return.