jeudi 31 janvier 2019

How to handel callback for a previous request

I have a hypothetical scenario for which I do not have a dummy code to list here.

Say we have two classes with each class registering a callback to each other - example Class A member function will be called by Class B as a callback and provides its own member method as std::function argument to callback when it is done. Now Class B waits on a timed semaphore for a response / callback after to which it will accept another request of a flow.

What will happen when response is now received for a previous request - how can we drop that call or ensure that nothing needs to be done now or identify that it is a response callback for a previous flow - in order to ensure that we fetch response from a mapped callback within a flow?

Aucun commentaire:

Enregistrer un commentaire