CmdThread do not catch and forward exceptions to the main thread
Many camera plugins use CmdThread
to make commands that take a long time asynchronous.
Commands (see execCmd
) are executed in cmdLoop()
but there is no try catch
block to handle exceptions, which means that the loop (and then thread) is exited when an exception if thrown from a command. The plugin is then in dangling state, unable to execute any commands and a restart is required.
A possible implementation would be to catch and store the exception in the cmdLoop()
and pop and rethrow it in the next call to waitStatus()
/ waitNotStatus()
.
Most calls to sendCmd
are followed by waitStatus()
/ waitNotStatus()
.