Hello,
I read the tinyos programming guide, but didn't understand exactly
this part of manual(page 41) :

"The atomic block promises that these variables can be read and
written atomically. Note that this does
not promise that the atomic block won't be preempted. Even with atomic
blocks, two code segments that do
not touch any of the same variables can preempt one another. For example:

async command bool a() {
        atomic {
                a++;
                b = a + 1;
        }
}
async command bool c() {
        atomic {
                c++;
                d = c + 1;
        }
}

In this example, c can (theoretically) preempt a without violating
atomicity. But a can't preempt itself,
nor can c preempt itself."

my questions :
1-In the above example how c can preempt a?
2-When atomic code is being executed , interrupts are disabled , so
why this does
not promise that the atomic block won't be preempted?

thanks
_______________________________________________
Tinyos-help mailing list
Tinyos-help@millennium.berkeley.edu
https://www.millennium.berkeley.edu/cgi-bin/mailman/listinfo/tinyos-help

Reply via email to