Blocking calls: cancel
The C++ and Java API provide blocking calls:
- Publisher.waitForSubscribers
- Subscriber.receive
- Requester.request
- Responder.receive
- Instance.waitFor
The current implementation of cancel - e.g. called from a stop handler does not work well. It supposes the objects are waiting in a previous call. An improvement must be done:
- Each object has the state waiting: true/false
- Each object has the state canceled: true/false
The canceled state is terminal: once an object is canceled it cannot revert to uncanceled.
These states must be managed properly by the associated waiting object.
- A common mutex blocks the access of the two states
- waiting false then canceled true: does not send the cancel "signal"
- waiting true then canceled true: sends the cancel "signal"
- canceled true then waiting true: does not send the cancel "signal" but the call returns immediately
We can add the create calls for the different objects except Instance. How to manage?