Our compilers will sometimes produce a warning about
a non-interruptible temporary:
#include <u.h>
#include <libc.h>
void
f(vlong a)
{
vlong x, y, z;
x = y = z = a;
}
cpu% 5c -w test.c
warning: /fd/0:7 non-interruptable temporary
warning: /fd/0:7 non-interruptable temporary
I know this means that the intermediate values
cannot be assigned atomically, but I don't see
why this rates a warning. From what I understand,
the uninterruptability of the temporaries should
be unobservable as long as our note handlers
save and restore registers correctly.
The only case I can think of is that a note
handler may see "tearing" of a register, but
that doesn't require a non-interruptible
temporary -- this kind of code will suffice:
vlong x;
int
use_x(){ return x; }
void
main(void)
{
atnotify(use_x, 1);
while(1)
x++;
}
Why do we warn about non-interruptible
temporaries? What issues am I missing?
------------------------------------------
9fans: 9fans
Permalink:
https://9fans.topicbox.com/groups/9fans/Tdcfb8f84c90eb199-M4d085665c267ba8bfe227bbf
Delivery options: https://9fans.topicbox.com/groups/9fans/subscription