httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Dean Gaudet <dgau...@arctic.org>
Subject Re: [PATCH] NT cleanup
Date Mon, 16 Jun 1997 17:27:45 GMT
On Mon, 16 Jun 1997, Jim Jagielski wrote:
> > ! #define acquire_mutex(mutex_id)	{}
> > ! #define release_mutex(mutex_id) {}
> Oh yeah... nt/multithread.c does the right thing with respect
> to these functions.

But why take a function setup/cleanup hit ... #define is better.  Also
you should use:

#define acquire_mutex(mutex_id)	do {} while(0)
#define release_mutex(mutex_id) do {} while(0)

because a ; following that is a valid single block.  Whereas {}; is a block
and a statement.  Consider the following:

if (blahblah)
    acquire_mutex(id);
else {
    asdfasdf
    asdfasdf
}

You'll see do {} while(0) #defines in lots of code, it's just syntactic
sugar to get around that possible problem.

Dean


Mime
View raw message