aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEric W. Biederman <ebiederm@xmission.com>2011-04-12 04:28:32 -0700
committerEric W. Biederman <ebiederm@xmission.com>2011-04-12 14:41:24 -0700
commit2674de6ed89756ad1b6954354e461bfd36f9d402 (patch)
treed43e876b6ceb8eec4c38eaa49b1ee6b1483ecc4d
parentab069ae1cf9894aad1c68343e8c568d083f4270c (diff)
downloadsyslinux-devel-2674de6ed89756ad1b6954354e461bfd36f9d402.tar.gz
syslinux-devel-2674de6ed89756ad1b6954354e461bfd36f9d402.tar.xz
syslinux-devel-2674de6ed89756ad1b6954354e461bfd36f9d402.zip
core: thread: Implement polling for wakeups.
For some reason the core_pm_hook is not getting called every time we get an interrupt with the result that in some situations like arping for our neighbours mac address or a tftp transfer we can stall, we never move forward again. The reason for those stalls likely bears more investigating but for now it is sufficient for me to know that they exist and that I can work around them by polling for wakekup conditions everytime we call schedule. That gives us code that works reliably and stays within the letter of the pxe spec. The oddities of the pxelinux core can be ironed out later. Signed-off-by: Eric W. Biederman <ebiederm@xmission.com>
-rw-r--r--core/include/thread.h2
-rw-r--r--core/thread/schedule.c10
2 files changed, 12 insertions, 0 deletions
diff --git a/core/include/thread.h b/core/include/thread.h
index cdc3a901..704962e1 100644
--- a/core/include/thread.h
+++ b/core/include/thread.h
@@ -32,6 +32,8 @@ struct thread {
extern int __schedule_lock;
extern bool __need_schedule;
+extern void (*sched_hook_func)(void);
+
void __thread_process_timeouts(void);
void __schedule(void);
void __switch_to(struct thread *);
diff --git a/core/thread/schedule.c b/core/thread/schedule.c
index 1bc02f62..674245ab 100644
--- a/core/thread/schedule.c
+++ b/core/thread/schedule.c
@@ -3,6 +3,7 @@
int __schedule_lock;
bool __need_schedule;
+void (*sched_hook_func)(void);
/*
* __schedule() should only be called with interrupts locked out!
@@ -17,6 +18,15 @@ void __schedule(void)
return;
}
+ /* Possibly update the information on which we make
+ * scheduling decisions.
+ */
+ if (sched_hook_func) {
+ __schedule_lock++;
+ sched_hook_func();
+ __schedule_lock--;
+ }
+
__need_schedule = false;
best = NULL;