Skip site navigation (1)Skip section navigation (2)
Date:      Tue, 9 Oct 2001 14:49:18 +1000 (EST)
From:      Bruce Evans <bde@zeta.org.au>
To:        John Baldwin <jhb@FreeBSD.org>
Cc:        <cvs-committers@FreeBSD.org>, <cvs-all@FreeBSD.org>
Subject:   Re: cvs commit: src/sys/i386/include atomic.h
Message-ID:  <20011009143716.N22621-100000@delplex.bde.org>
In-Reply-To: <200110082058.f98KwPp88784@freefall.freebsd.org>

next in thread | previous in thread | raw e-mail | index | archive | help
On Mon, 8 Oct 2001, John Baldwin wrote:

> jhb         2001/10/08 13:58:25 PDT
>
>   Modified files:
>     sys/i386/include     atomic.h
>   Log:
>   Allow atomic ops to be somewhat safely used in userland.  We always use
>   lock prefixes in the userland case so that the binaries will work on both
>   SMP and UP systems.
>
>   Revision  Changes    Path
>   1.21      +8 -4      src/sys/i386/include/atomic.h

I don't want the current bad interface exported to userland where it is
harder to fix.  The interface should by type-generic.  E.g.,
atomic_add(lvalue, rvalue) instead of:

#ifdef TYPE_IS_KNOWN_TO_BE_VOLATILE_CHAR
atomic_add_char(&lvalue, rvalue)	/* sic */
#elif TYPE_IS_KNOWN_TO_BE_CHAR
/* Use the interface for volatile chars, although this may be pessimal. */
atomic_add_char(&lvalue, rvalue)
#elif TYPE_IS_KNOWN_TO_BE_UNSIGNED_CHAR
/* XXX abuse atomic_add_char() since there is no atomic_add_unsigned_char(). */
atomic_add_char(&lvalue, rvalue)
...
#elif TYPE_IS_KNOWN_TO_BE_SHORT
atomic_add_short(&lvalue, rvalue)
...
#endif

Bruce


To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe cvs-all" in the body of the message




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