I have an application where I want to call getCurrentConfiguration and setConfiguration from (different) callbacks. These may be called at arbitrary times, in arbitrary order. I'm running with a normal (single threaded) spinner.
The problem can be understood like this:
One callback calls setConfiguration on the client. This resets the received_configuration_ flag to false.
The server responds to the service, and by sending the updated parameters on the parameter_updates topic. The client has a callback on this topic, which will be put in the callback queue. This will set the received_configuration_ flag to true again.
A second callback calls getCurrentConfiguration on the client. This blocks until the received_configuration_ flag is set to true.
The thread may now be blocked, depending on whether the parameter_updates message is put first or second in the callback queue.
I have an application where I want to call
getCurrentConfiguration
andsetConfiguration
from (different) callbacks. These may be called at arbitrary times, in arbitrary order. I'm running with a normal (single threaded) spinner.The problem can be understood like this:
setConfiguration
on the client. This resets thereceived_configuration_
flag tofalse
.parameter_updates
topic. The client has a callback on this topic, which will be put in the callback queue. This will set thereceived_configuration_
flag totrue
again.getCurrentConfiguration
on the client. This blocks until thereceived_configuration_
flag is set totrue
.The thread may now be blocked, depending on whether the
parameter_updates
message is put first or second in the callback queue.