aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorH. Peter Anvin <hpa@zytor.com>2009-09-10 17:50:26 -0700
committerH. Peter Anvin <hpa@zytor.com>2009-09-10 17:50:26 -0700
commitfbab95e73c9f4ad26e29d4db5ce1ffc9e89b4e9d (patch)
treef17c75ef1eedff0257c718a64cf83e93cf32eba8
parent506a5baf17a1f005c84cde422d8a6007f94324ee (diff)
downloadlwip-fbab95e73c9f4ad26e29d4db5ce1ffc9e89b4e9d.tar.gz
lwip-fbab95e73c9f4ad26e29d4db5ce1ffc9e89b4e9d.tar.xz
lwip-fbab95e73c9f4ad26e29d4db5ce1ffc9e89b4e9d.zip
thread: add support for locking the scheduler
Add support for locking the scheduler; this is needed for the pm return hook to operate properly. Signed-off-by: H. Peter Anvin <hpa@zytor.com>
-rw-r--r--core/include/core.h3
-rw-r--r--core/include/thread.h3
-rw-r--r--core/thread/schedule.c10
-rw-r--r--core/thread/timeout.c2
4 files changed, 18 insertions, 0 deletions
diff --git a/core/include/core.h b/core/include/core.h
index 63a1ee34..7148ccd8 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -15,6 +15,9 @@ extern char KernelName[];
/* diskstart.inc isolinux.asm*/
extern void getlinsec(void);
+/* pm.inc */
+extern void (*core_pm_hook)(void);
+
/* getc.inc */
extern void core_open(void);
diff --git a/core/include/thread.h b/core/include/thread.h
index 9171eaab..c26e795b 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -30,6 +30,9 @@ struct thread {
int prio;
};
+extern int __schedule_lock;
+extern bool __need_schedule;
+void __thread_process_timeouts(void);
void __schedule(void);
void __switch_to(struct thread *);
void thread_yield(void);
diff --git a/core/thread/schedule.c b/core/thread/schedule.c
index b139c43d..1bc02f62 100644
--- a/core/thread/schedule.c
+++ b/core/thread/schedule.c
@@ -1,6 +1,9 @@
#include <sys/cpu.h>
#include "thread.h"
+int __schedule_lock;
+bool __need_schedule;
+
/*
* __schedule() should only be called with interrupts locked out!
*/
@@ -9,6 +12,13 @@ void __schedule(void)
struct thread *curr = current();
struct thread *st, *nt, *best;
+ if (__schedule_lock) {
+ __need_schedule = true;
+ return;
+ }
+
+ __need_schedule = false;
+
best = NULL;
/*
diff --git a/core/thread/timeout.c b/core/thread/timeout.c
index 05f5352d..bf7517c5 100644
--- a/core/thread/timeout.c
+++ b/core/thread/timeout.c
@@ -33,6 +33,8 @@ void __thread_process_timeouts(void)
t->blocked = NULL;
block->timed_out = true;
+
+ __schedule(); /* Normally sets just __need_schedule */
}
}
}