httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Jim Jagielski <...@jaguNET.com>
Subject Re: [PATCH] NT cleanup
Date Mon, 16 Jun 1997 18:46:15 GMT
+1

Dean Gaudet wrote:
> 
> 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
> 


-- 
====================================================================
      Jim Jagielski            |       jaguNET Access Services
     jim@jaguNET.com           |       http://www.jaguNET.com/
            "Look at me! I'm wearing a cardboard belt!"

Mime
View raw message