Closed bmegli closed 7 years ago
MODULE_DISABLE_TRIES
times sleep MODULE_DISABLE_MS
and try nonblocking waitpid
SIGINT
to child and MODULE_DISABLE_TRIES
sleep MODULE_DISABLE_MS
and try nonblocking waitpid
SIGKILL
and MODULE_DISABLE_TRIES
sleep MODULE_DISABLE_MS
and try nonblocking waitpid
stderr
Initally:
MODULE_DISABLE_TRIES=3
MODULE_DISABLE_MS=50
It can happen that misbehaving module (on EV3) is stuck on blocking IO (e.g. laser waititing for synchronization without running motor properly) and will not know that it's stdin was closed by ev3control.
This way request from ev3control to disable module will wait indefinitely.
Give some timeout for child to close and if it is naughty kill it with a signal.
A child will get SIGINT in IO call and finish gracefully (at least this is what modules already do on SIGINT in most cases).
So:
Optionally if it's still misbehaving after that kill it mercilessly