> On 01-Feb-01 Matthew Emmerton wrote:
> >> 2) atomic_set_int(&my_int, 4); sets bit _2_ in the integer variable
> > my_int.
> >> Make sense?  You can't address individual bits on a machine. :-P
> >>
> >> > I presume that I could wrap the char operations with something that
> > takes
> >> > 0x01 and bit-shifts it appropriately so that atomic_set/clear could
be
> > used.
> >>
> >> Hmm, so you mean the API is atomic_set(&foo, x) implies foo |= 1 << x?
> >> That means you can't set more than 1 bit atomically, which is a bit
> >> limiting.
> >
> > Yes, but it's the API used by some code I recently inherited.  (Recall
that
> > this API is Linux's asm/bitops.h)  I realize that the existing
> > atomic_xxx_xxx functions are much more flexible than bit-based ones, but
> > wouldn't it make sense to have the full complement of functions
available?
>
> If you don't want to patch the code, then you can use a local wrapper in
your
> code in the form of a suitable macro.  We already have one atomic API, we
don't
> need to maintain 2. :)

Well, I wasn't proposing to implement the entire Linux API, rather add 'bit'
to the the existing list of 'char, int, long' that is currently supported.
It wouldn't be too difficult, and some people might even find it convenient.

--
Matt Emmerton



To Unsubscribe: send mail to [EMAIL PROTECTED]
with "unsubscribe freebsd-hackers" in the body of the message

Reply via email to