Date: Tue, 3 Oct 2000 11:24:14 -0700 (PDT) From: jdp@polstra.com To: hackers@freebsd.org Cc: bright@wintelcom.net Subject: Re: atomic operations Message-ID: <200010031824.e93IOEQ16876@vashon.polstra.com> In-Reply-To: <20001003012240.G27736@fw.wintelcom.net> References: <00b701c0273b$39f7aaa0$0901a8c0@haym.transactionsite.com> <XFMail.001003000139.jhb@FreeBSD.org> <20001003012240.G27736@fw.wintelcom.net>
next in thread | previous in thread | raw e-mail | index | archive | help
In article <20001003012240.G27736@fw.wintelcom.net>,
Alfred Perlstein <bright@wintelcom.net> wrote:
>
> +typedef struct { volatile int a; } atomic_t;
> +
> +#define atomic_init(p, v) do { p->a = v; } while(0)
> +#define atomic_destroy(p) do { ; } while(0)
I don't see the need for the do ... while(0) construct here. Why not
something simpler?
#define atomic_init(p, v) ((p)->a = (v))
#define atomic_destroy(p) ((void)0)
Likewise for atomic_set(), which seems to do the same thing as
atomic_init().
John
--
John Polstra jdp@polstra.com
John D. Polstra & Co., Inc. Seattle, Washington USA
"Disappointment is a good sign of basic intelligence." -- Chögyam Trungpa
To Unsubscribe: send mail to majordomo@FreeBSD.org
with "unsubscribe freebsd-hackers" in the body of the message
Want to link to this message? Use this URL: <https://mail-archive.FreeBSD.org/cgi/mid.cgi?200010031824.e93IOEQ16876>
