Forgot to resume the kernel_daemon thread.

Actually never unlocked the daemon's lock (always called mutex_lock() instead
of mutex_unlock()...).


git-svn-id: file:///srv/svn/repos/haiku/trunk/current@2568 a95241bf-73f2-0310-859d-f6bbb57e9c96
This commit is contained in:
Axel Dörfler 2003-01-27 02:02:20 +00:00
parent 429578fb0b
commit dc7fb22c07

View File

@ -47,7 +47,7 @@ kernel_daemon(void *data)
if (((iteration + daemon->offset) % daemon->frequency) == 0) if (((iteration + daemon->offset) % daemon->frequency) == 0)
daemon->function(daemon->arg, iteration); daemon->function(daemon->arg, iteration);
} }
mutex_lock(&gDaemonMutex); mutex_unlock(&gDaemonMutex);
iteration++; iteration++;
snooze(100000); // 0.1 seconds snooze(100000); // 0.1 seconds
@ -71,7 +71,7 @@ unregister_kernel_daemon(void (*function)(void *, int), void *arg)
break; break;
} }
} }
mutex_lock(&gDaemonMutex); mutex_unlock(&gDaemonMutex);
// if we've iterated through the whole list, we didn't // if we've iterated through the whole list, we didn't
// find the daemon, and "daemon" is NULL // find the daemon, and "daemon" is NULL
@ -114,7 +114,7 @@ register_kernel_daemon(void (*function)(void *, int), void *arg, int frequency)
daemon->offset = 0; daemon->offset = 0;
list_add_item(&gDaemons, daemon); list_add_item(&gDaemons, daemon);
mutex_lock(&gDaemonMutex); mutex_unlock(&gDaemonMutex);
return B_OK; return B_OK;
} }
@ -123,10 +123,13 @@ register_kernel_daemon(void (*function)(void *, int), void *arg, int frequency)
status_t status_t
kernel_daemon_init(void) kernel_daemon_init(void)
{ {
thread_id thread;
if (mutex_init(&gDaemonMutex, "kernel daemon") < B_OK) if (mutex_init(&gDaemonMutex, "kernel daemon") < B_OK)
return B_ERROR; return B_ERROR;
list_init(&gDaemons); list_init(&gDaemons);
return spawn_kernel_thread(&kernel_daemon, "kernel daemon", B_LOW_PRIORITY, NULL); thread = spawn_kernel_thread(&kernel_daemon, "kernel daemon", B_LOW_PRIORITY, NULL);
return resume_thread(thread);
} }