]> oss.titaniummirror.com Git - tinyos-2.x.git/blobdiff - tos/lib/tosthreads/system/ThreadSleepP.nc
Merge TinyOS 2.1.1 into master.
[tinyos-2.x.git] / tos / lib / tosthreads / system / ThreadSleepP.nc
index 65554cf0298b61291e3572adfd156570afcce5fe..d78212d99aa729b7ee10410a1a3dbb60a288ef05 100644 (file)
@@ -62,8 +62,20 @@ implementation {
     return SUCCESS;
   }
   
+  //Need to add a cancel command so that components like
+  //BlockingAMReceiverImplP can use the ThreadSleep interface
+  //directly instead of reusing the underlying ThreadTimerC 
+  //component.  The current implementation does things this way
+  //and causes us to be defensive in here since the same 
+  //TimerMilli.fired() event is sent to that component as well.
+  //Basically its just broken....  cancel() would get rid of this.
+  
+  //Also need some sort of a sleepWithSyscall command
+  //Need to think about this one a little more
+  
   event void TimerMilli.fired[uint8_t id]() {
     thread_t* t = call ThreadScheduler.threadInfo(id);
-    call SystemCall.finish(t->syscall);
+    if(t->syscall->syscall_ptr == sleepTask)
+           call SystemCall.finish(t->syscall);
   }
 }