[syslinux:lwip] thread: add support for locking the scheduler
syslinux-bot for H. Peter Anvin
hpa at zytor.com
Fri Apr 22 20:05:07 PDT 2011
Commit-ID: cd8b37053cc36014379fefdecf1d409bc7dc5b45
Gitweb: http://syslinux.zytor.com/commit/cd8b37053cc36014379fefdecf1d409bc7dc5b45
Author: H. Peter Anvin <hpa at zytor.com>
AuthorDate: Thu, 10 Sep 2009 17:50:26 -0700
Committer: Eric W. Biederman <ebiederm at xmission.com>
CommitDate: Sat, 9 Apr 2011 18:27:06 -0700
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 at zytor.com>
---
core/include/core.h | 3 +++
core/include/thread.h | 3 +++
core/thread/schedule.c | 10 ++++++++++
core/thread/timeout.c | 2 ++
4 files changed, 18 insertions(+), 0 deletions(-)
diff --git a/core/include/core.h b/core/include/core.h
index a593c26..62a61f6 100644
--- a/core/include/core.h
+++ b/core/include/core.h
@@ -18,6 +18,9 @@ extern char ConfigFile[];
/* 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 55a3ed7..7d34676 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -28,6 +28,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 b139c43..1bc02f6 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 2ca0782..409ad6d 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 */
}
}
}
More information about the Syslinux-commits
mailing list