Опрос выдает ложное исключение при извлечении устройстваLinux

Ответить
Гость
 Опрос выдает ложное исключение при извлечении устройства

Сообщение Гость »


В кодовой базе, над которой я работаю, используется function to check whether file descriptors can be read from. One of these file descriptors is a USB device we communicate with directly, and I need to detect when it gets physically disconnected from the computer. However, the program crashes while waiting for file descriptors. When debugging, I get a message "Exception has occurred" along with a "continued" or "Hangup" note, but it's not a real exception I can catch (obviously, since I'm using a C function, despite this being a C++ program). How can I prevent my program from crashing and ideally detect that the device was disconnected (i.e. the fd gets deleted)? We only need to support Linux if it matters.
I tried catching the exception and reading the returned value along with error codes.


Источник: https://stackoverflow.com/questions/781 ... pulled-out
Ответить

Быстрый ответ

Изменение регистра текста: 
Смайлики
:) :( :oops: :roll: :wink: :muza: :clever: :sorry: :angel: :read: *x)
Ещё смайлики…
   
К этому ответу прикреплено по крайней мере одно вложение.

Если вы не хотите добавлять вложения, оставьте поля пустыми.

Максимально разрешённый размер вложения: 15 МБ.

Вернуться в «Linux»