prepared periodic services

git-svn-id: file:///srv/svn/repos/haiku/haiku/trunk@15972 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Marcus Overhagen
2006-01-16 13:13:38 +00:00
parent 16160d6099
commit cba0addf98
@@ -14,6 +14,8 @@ static sem_id sServiceSem;
static thread_id sServiceThread; static thread_id sServiceThread;
static volatile bool sServiceTerminate; static volatile bool sServiceTerminate;
#define PS2_SERVICE_INTERVAL 200000
void void
ps2_service_handle_device_added(ps2_dev *dev) ps2_service_handle_device_added(ps2_dev *dev)
@@ -63,11 +65,20 @@ static int32
ps2_service_thread(void *arg) ps2_service_thread(void *arg)
{ {
for (;;) { for (;;) {
while (B_INTERRUPTED == acquire_sem(sServiceSem)) status_t status;
; status = acquire_sem_etc(sServiceSem, 1, B_RELATIVE_TIMEOUT, PS2_SERVICE_INTERVAL);
if (sServiceTerminate) if (sServiceTerminate)
break; break;
if (status == B_OK) {
// process service commands
} else if (status == B_TIMED_OUT) {
// do periodic processing
} else {
dprintf("ps2_service_thread: Error, status 0x%08x, terminating\n");
break;
}
} }
return 0; return 0;
} }