I read serial port by thread function.
when I turn off the power and then back turn on,
the device is locked just by the thread?

can I prevent?

in the same porblem, when I read serial port as date from GPS card,
when the card is disconnecting it locks a whole device.

can I prevent?