* [9fans] non-interruptible temporary: why do we care?
@ 2021-01-04 3:32 ori
0 siblings, 0 replies; only message in thread
From: ori @ 2021-01-04 3:32 UTC (permalink / raw)
To: 9fans
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
^ permalink raw reply [flat|nested] only message in thread
only message in thread, other threads:[~2021-01-04 3:32 UTC | newest]
Thread overview: (only message) (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-01-04 3:32 [9fans] non-interruptible temporary: why do we care? ori
9fans - fans of the OS Plan 9 from Bell Labs
This inbox may be cloned and mirrored by anyone:
git clone --mirror http://inbox.vuxu.org/9fans
# If you have public-inbox 1.1+ installed, you may
# initialize and index your mirror using the following commands:
public-inbox-init -V1 9fans 9fans/ http://inbox.vuxu.org/9fans \
9fans@9fans.net
public-inbox-index 9fans
Example config snippet for mirrors.
Newsgroup available over NNTP:
nntp://inbox.vuxu.org/vuxu.archive.9fans
AGPL code for this site: git clone https://public-inbox.org/public-inbox.git