aboutsummaryrefslogtreecommitdiff
path: root/src/kernel/core/thread.c
diff options
context:
space:
mode:
authorAlex Auvolat <alex@adnab.me>2015-03-14 12:56:22 +0100
committerAlex Auvolat <alex@adnab.me>2015-03-14 12:56:22 +0100
commitdabd2355f355abd7d1d58641f6cc496adb1482d1 (patch)
tree48f674f68b5ec2314d4dd7735af0db0af3408c49 /src/kernel/core/thread.c
parent151edb44eea9bf25ec466133e9dbef87bd6b1372 (diff)
downloadkogata-dabd2355f355abd7d1d58641f6cc496adb1482d1.tar.gz
kogata-dabd2355f355abd7d1d58641f6cc496adb1482d1.zip
Add mutexes everywhere ; spam debug log (sorry)
Diffstat (limited to 'src/kernel/core/thread.c')
-rw-r--r--src/kernel/core/thread.c26
1 files changed, 13 insertions, 13 deletions
diff --git a/src/kernel/core/thread.c b/src/kernel/core/thread.c
index 53b3e70..c4d4f93 100644
--- a/src/kernel/core/thread.c
+++ b/src/kernel/core/thread.c
@@ -120,7 +120,7 @@ void run_scheduler() {
// At this point, interrupts are disabled
// This function is expected NEVER TO RETURN
- /*thread_t *prev_thread = current_thread;*/
+ thread_t *prev_thread = current_thread;
if (current_thread != 0 && current_thread->state == T_STATE_RUNNING) {
current_thread->last_ran = get_kernel_time();
@@ -129,7 +129,7 @@ void run_scheduler() {
}
current_thread = dequeue_thread();
- /*if (current_thread != prev_thread) dbg_printf("[0x%p]\n", current_thread);*/
+ if (current_thread != prev_thread) dbg_printf("[0x%p]\n", current_thread);
if (current_thread != 0) {
thread_t *ptr = current_thread;
@@ -345,19 +345,19 @@ void usleep(int usecs) {
if (ok) wait_on(current_thread);
}
-void exit() {
- void exit_cleanup_task(void* v) {
- thread_t *t = (thread_t*)v;
-
- if (t->proc == 0) {
- // stand alone thread, can be deleted safely
- delete_thread(t);
- } else {
- // call specific routine from process code
- process_thread_exited(t);
- }
+void exit_cleanup_task(void* v) {
+ thread_t *t = (thread_t*)v;
+
+ if (t->proc == 0) {
+ // stand alone thread, can be deleted safely
+ delete_thread(t);
+ } else {
+ // call specific routine from process code
+ process_thread_exited(t);
}
+}
+void exit() {
int st = enter_critical(CL_NOSWITCH);
// the critical section here does not guarantee that worker_push will return immediately
// (it may switch before adding the delete_thread task), but once the task is added