[hypercos] [PATCH 1/4] sch: Add wakeup listener interface

  • From: Howard Chen <ibanezchen@xxxxxxxxx>
  • To: socware.help@xxxxxxxxx, hypercos@xxxxxxxxxxxxx
  • Date: Wed, 2 Nov 2016 10:29:19 +0800

---
 src/sch.h    | 4 ++++
 src/sch_pq.c | 5 +++++
 2 files changed, 9 insertions(+)

diff --git a/src/sch.h b/src/sch.h
index 552c959..d2f90a9 100644
--- a/src/sch.h
+++ b/src/sch.h
@@ -27,6 +27,10 @@
 #ifndef SCH150904
 #define SCH150904
 
+struct task;
+
+extern void (*sch_wake_notify) (struct task * t);
+
 void sch_schedule(unsigned hint);
 
 /// wake up thread, possible trigger an immediate context switch if t's
diff --git a/src/sch_pq.c b/src/sch_pq.c
index 2fd5d3b..f844c4f 100644
--- a/src/sch_pq.c
+++ b/src/sch_pq.c
@@ -28,6 +28,8 @@
 #include "task.h"
 #include "io.h"
 
+void (*sch_wake_notify) (struct task * t);
+
 static ll_t task_ready[CFG_TPRI_NUM];
 
 #if CFG_SCH_PQ == 1
@@ -183,6 +185,9 @@ void sch_wake(task_t * t)
                        _task_switch_pend(t);
                else
                        _task_switch_sync(t, _task_switch_status(t));
+       } else {
+               if (sch_wake_notify)
+                       sch_wake_notify(t);
        }
 }
 
-- 
2.5.0


Other related posts:

  • » [hypercos] [PATCH 1/4] sch: Add wakeup listener interface - Howard Chen