[pisa-src] r1099 - in trunk: include libpisa

  • From: Thomas Jansen <mithi@xxxxxxxxx>
  • To: pisa-src@xxxxxxxxxxxxx
  • Date: Mon, 12 Oct 2009 18:15:59 +0200

Author: tjansen
Date: Mon Oct 12 18:15:58 2009
New Revision: 1099

Log:
Make the task list a single linked list.

Modified:
   trunk/include/scheduler.h
   trunk/libpisa/scheduler.c

Modified: trunk/include/scheduler.h
==============================================================================
--- trunk/include/scheduler.h   Mon Oct 12 17:47:02 2009        (r1098)
+++ trunk/include/scheduler.h   Mon Oct 12 18:15:58 2009        (r1099)
@@ -18,9 +18,11 @@
 
 typedef void (*pisa_sched_func)(void *data);
 
-typedef struct {
+typedef struct pisa_sched_task {
        pisa_sched_func func;
-       time_t t;
+       struct timeval due;
+       void *data;
+       struct pisa_sched_task *next;
 } pisa_sched_task;
 
 void pisa_sched_init(int *shared);

Modified: trunk/libpisa/scheduler.c
==============================================================================
--- trunk/libpisa/scheduler.c   Mon Oct 12 17:47:02 2009        (r1098)
+++ trunk/libpisa/scheduler.c   Mon Oct 12 18:15:58 2009        (r1099)
@@ -26,13 +26,22 @@
 static pthread_t thread;
 
 /**
+ * Head of the task list.
+ */
+static pisa_sched_task *head = NULL;
+
+/**
  * Main function of the scheduler thread
  */
 static void *pisa_sched_main(void *arg)
 {
        /* TODO: sleep until first element is due. */
-       while (1)
-               sleep(1);
+       while (1) {
+               if (head == NULL)
+                       sleep(1);
+               else
+                       sleep(2);
+       }
 
        return NULL;
 }

Other related posts:

  • » [pisa-src] r1099 - in trunk: include libpisa - Thomas Jansen