9fans - fans of the OS Plan 9 from Bell Labs
 help / color / mirror / Atom feed
* [9fans] non-interruptible temporary: why do we care?
@ 2021-01-04  3:32 ori
  2021-06-16 20:23 ` unobe
  0 siblings, 1 reply; 10+ messages 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] 10+ messages in thread

end of thread, other threads:[~2021-06-20 21:15 UTC | newest]

Thread overview: 10+ messages (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
2021-06-16 20:23 ` unobe
2021-06-16 20:28   ` ori
2021-06-17 19:32     ` Charles Forsyth
2021-06-16 21:10   ` Anthony Martin
2021-06-16 21:28     ` unobe
2021-06-20 14:53   ` [9fans] help Spock via 9fans
2021-06-20 15:32     ` Marshall Conover
2021-06-20 18:46       ` U Cirello
2021-06-20 21:14       ` Ethan Gardener

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).