[Tinyos-host-mote-wg] Re: [Tinyos-2.0wg] proposed Scheduler
interface change
Jan Hauer
jan.hauer at gmail.com
Sat Oct 15 17:28:15 PDT 2005
On 10/15/05, David Gay <dgay42 at gmail.com> wrote:
> On 10/15/05, Philip Levis <pal at cs.stanford.edu> wrote:
> > On Oct 15, 2005, at 11:20 AM, David Gay wrote:
> > > Minor related change: __nesc_atomic_sleep should disable interrupts
> > > after the sleep completes. This isn't really necessary, but it makes
> > > its use inside an atomic section cleaner.
> >
> > I think this is chip-dependent. IIRC, Phil B. had some observations
> > about this when working on the px, where sleep automatically re-
> > enabled interrupts? This is what led to the atomic sleep call...
>
> That's not the question. The question is, once the sleep completes
> (presumably because some interrupt just ran), should we redisable
> interrupts (non-atomically)? I'd say yes, because __nesc_atomic_sleep
> (implicitly) starts with interrupts off. It's not particularly
> crucial, though, because you can of course just write:
> __nesc_atomic_sleep();
> __nesc_enable_interrupts();
Looking at the code of Scheduler.taskLoop(), I think it IS crucial
that __nesc_atomic_sleep(); is followed by a
__nesc_disable_interrupts();.
Otherwise this could happen after waking up:
1. Next statement is: while ((nextTask = popTask()) == NO_TASK), let's
say there is no task (i.e. the previous ISR did not post one).
2. Now we would again execute __nesc_atomic_sleep(); But assume that
just before another interrupt hits (i.e. after evaluating that there
is no task but before the sleep), and this ISR does post a task.
3. Now the task-queue is not empty, but we still go to sleep.
Maybe I am missing something, but this is important code...
Jan
>
> David
>
> _______________________________________________
> Tinyos-2.0wg mailing list
> Tinyos-2.0wg at Mail.Millennium.Berkeley.EDU
> https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-2.0wg
>
>
_______________________________________________
Tinyos-2.0wg mailing list
Tinyos-2.0wg at Mail.Millennium.Berkeley.EDU
https://mail.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-2.0wg
More information about the Tinyos-host-mote-wg
mailing list