[syslinux:lwip] core: thread: Implement polling for wakeups.

syslinux-bot for Eric W. Biederman ebiederm at xmission.com
Fri Apr 22 20:06:13 PDT 2011

Commit-ID:  2674de6ed89756ad1b6954354e461bfd36f9d402
Gitweb:     http://syslinux.zytor.com/commit/2674de6ed89756ad1b6954354e461bfd36f9d402
Author:     Eric W. Biederman <ebiederm at xmission.com>
AuthorDate: Tue, 12 Apr 2011 04:28:32 -0700
Committer:  Eric W. Biederman <ebiederm at xmission.com>
CommitDate: Tue, 12 Apr 2011 14:41:24 -0700

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 at xmission.com>

 core/include/thread.h  |    2 ++
 core/thread/schedule.c |   10 ++++++++++
 2 files changed, 12 insertions(+), 0 deletions(-)

diff --git a/core/include/thread.h b/core/include/thread.h
index cdc3a90..704962e 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 1bc02f6..674245a 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)
+    /* 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;

More information about the Syslinux-commits mailing list