Skip site navigation (1)Skip section navigation (2)
Date:      Wed, 12 Mar 1997 03:16:27 +1100
From:      Bruce Evans <bde@zeta.org.au>
To:        bde@zeta.org.au, brian@shift.lan.awfulhak.org
Cc:        ache@nagual.ru, brian@awfulhak.demon.co.uk, brian@utell.co.uk, current@freebsd.org
Subject:   Re: ppp
Message-ID:  <199703111616.DAA20223@godzilla.zeta.org.au>

next in thread | raw e-mail | index | archive | help
>&= ~ isn't guaranteed atomic ?  Yeuch.  I'd tend to go with Andrey's

Nothing is guaranteed to be atomic in C.  The closest it gets is
objects of type sig_atomic_t, which can safely be set (but not read)
in signal handlers.

>suggestion that I use an int array rather than a bit array.  I assume
>that ++ and -- are guaranteed to be atomic (if they're not, I'm in *lots*
>of trouble).

No, ++ and -- guaranteed to be atomic.  They are good candidates for
splitting up into read/modify/write so that they can be pipelined better.
In practice, the i386 version of gcc is usually too stupid to do this.

The kernel handles the corresponding problems for interrupts by using
assembler code to get instructions that are known to be atomic.  It
could also use some form of locking, but locking tends to be slower.
Kernel locking using splhigh()/splx() corresponds exactly to
sigprocmask(SIG_BLOCK...)/sigprocmask(SIG_SETMASK...).

Bruce



Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?199703111616.DAA20223>