[Tinyos-devel] Will safe protect this kind of code?
Eric Decker
cire831 at gmail.com
Wed Aug 13 13:30:18 PDT 2008
In particular, current_thread comes from either remove or dequeue. I've
seen situations when we were messing with early thread code where
current_thread actual got NULL and it wreck havoc.
Will safe and deputy detect current_thread becoming NULL?
Alternatively, I could do something like:
if (!current_thread)
panic(...);
else
current_thread->state = TOSTHREAD_STATE_ACTIVE;
but that is ugly.
eric
void scheduleNextThread() {
if(tos_thread->state == TOSTHREAD_STATE_READY)
current_thread = call ThreadQueue.remove(&ready_queue, tos_thread);
else
current_thread = call ThreadQueue.dequeue(&ready_queue);
current_thread->state = TOSTHREAD_STATE_ACTIVE;
}
--
Eric B. Decker
Senior (over 50 :-) Researcher
Autonomous Systems Lab
Jack Baskin School of Engineering
UCSC
-------------- next part --------------
An HTML attachment was scrubbed...
URL: https://www.millennium.berkeley.edu/pipermail/tinyos-devel/attachments/20080813/59700893/attachment.htm
More information about the Tinyos-devel
mailing list