apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Davi Arnaut <d...@haxent.com.br>
Subject Re: Regarding apr_file_writev() and locking...
Date Sat, 12 May 2007 12:32:48 GMT
Bojan Smojver wrote:
> On Fri, 2007-05-11 at 22:38 -0300, Davi Arnaut wrote:
> 
>> The patches improves the locking interaction with buffering.
> 
> Looking at the inline functions file_lock/unlock, wouldn't it be a bit
> more appropriate to do them as macros? I'm thinking on platforms that
> have a C compiler that doesn't understand inlining, we may be a bit
> better off.
> 
> Do you mind if I do macros instead?
> 

No, but this:

+#define file_lock(f)   { .. }
+#define file_unlock(f) { .. }

should be:

#define file_lock(f) do { .. } while (0)
#define file_unlock(f) do { .. } while (0)

or else it will break for expressions like:

	if (file->buffered || whatever)
		file_lock(f); /* semi-colon after the block */
	else
		whatever++;

--
Davi Arnaut

Mime
View raw message