]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/system/SchedulerBasicP.nc
Remove need for volatiles in scheduler by fixing McuSleep.sleep to tell
[tinyos-2.x.git] / tos / system / SchedulerBasicP.nc
index 0a62576a1dc1e21764e0bf619dc25185e51683f1..9f99fd668e1e9ae1acc57f39374079c1582dad2c 100644 (file)
@@ -1,6 +1,6 @@
 // $Id$
 
-/*                                                                     tab:4
+/*
  * "Copyright (c) 2000-2003 The Regents of the University  of California.  
  * All rights reserved.
  *
@@ -40,7 +40,7 @@
 
 #include "hardware.h"
 
-module SchedulerBasicP {
+module SchedulerBasicP @safe() {
   provides interface Scheduler;
   provides interface TaskBasic[uint8_t id];
   uses interface McuSleep;
@@ -53,9 +53,11 @@ implementation
     NO_TASK = 255,
   };
 
-  volatile uint8_t m_head;
-  volatile uint8_t m_tail;
-  volatile uint8_t m_next[NUM_TASKS];
+  uint8_t m_head;
+  uint8_t m_tail;
+  uint8_t m_next[NUM_TASKS];
+
+#define v_head (*(volatile uint8_t *)&m_head)
 
   // Helper functions (internal functions) intentionally do not have atomic
   // sections.  It is left as the duty of the exported interface functions to