[erlang-questions] Serial device supervision strategy
Camille Troillard
lists@REDACTED
Tue May 6 19:27:24 CEST 2014
Hello,
I am going back to Erlang after a bit of distraction, please excuse this rusty question.
My application has to connect to a serial device which may or may not be plugged to the computer.
It seemed a simple approach would be to try to connect to the device every seconds, and retry again until the connection is done. Ideally, I thought the design could be as follows: a gen_server (serial_endpoint) whose lifetime would be the same as the serial device’s connection is under supervision. If the serial_endpoint fails to start, then we try again a second later and so on. Likewise, if the connection is lost because the device is unplugged, the serial_endpoint dies, and we try again to start it a second later.
Unfortunately, I don’t see how to achieve this restart strategy.
Can someone help me find the right solution?
Thank you in advance.
Best Regards,
Camille
More information about the erlang-questions
mailing list