From a6b4486702c240025e4d77064bc1bdc7f7aabc90 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Stephan=20A=C3=9Fmus?= Date: Fri, 31 Oct 2008 17:31:21 +0000 Subject: [PATCH] * Do not continue in the loop when encountering B_INTERRUPTED from acquire_sem_etc(), but treat it as an error instead. This allows to kill device polling threads in the input_server and prevents a busy loop in the kernel then. Before the input_server was shutting down devices upon quit (happens only when restarting it), this busy loop could also be observed, since then polling threads would be quit on exit of the team. * Supply B_INFINITE_TIMEOUT for the MouseDevice instead of 0. Does not change anything, but was probably not intended. git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@28407 a95241bf-73f2-0310-859d-f6bbb57e9c96 --- src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp | 2 -- src/add-ons/kernel/drivers/input/usb_hid/MouseDevice.cpp | 6 ++---- 2 files changed, 2 insertions(+), 6 deletions(-) diff --git a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp index 4cf9d0cb3f..3c648045a1 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/KeyboardDevice.cpp @@ -89,8 +89,6 @@ KeyboardDevice::Control(uint32 op, void *buffer, size_t length) // the next timeout is reduced to the repeat_rate fCurrentRepeatDelay = fRepeatRate; break; - } else if (result == B_INTERRUPTED && IsOpen()) { - continue; } else return result; } diff --git a/src/add-ons/kernel/drivers/input/usb_hid/MouseDevice.cpp b/src/add-ons/kernel/drivers/input/usb_hid/MouseDevice.cpp index e42e5e4f75..c038d2e61e 100644 --- a/src/add-ons/kernel/drivers/input/usb_hid/MouseDevice.cpp +++ b/src/add-ons/kernel/drivers/input/usb_hid/MouseDevice.cpp @@ -45,10 +45,8 @@ MouseDevice::Control(uint32 op, void *buffer, size_t length) // NOTE: this thread is now blocking until the semaphore is // released in the callback function status_t result = acquire_sem_etc(fTransferNotifySem, 1, - B_CAN_INTERRUPT, 0); - if (result == B_INTERRUPTED && IsOpen()) - continue; - else if (result != B_OK) + B_CAN_INTERRUPT, B_INFINITE_TIMEOUT); + if (result != B_OK) return result; result = _InterpretBuffer();