apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Justin Erenkrantz <jerenkra...@ebuilt.com>
Subject Re: [PATCH] RW lock Iteration 2 for Windows
Date Mon, 30 Apr 2001 23:13:30 GMT
On Mon, Apr 30, 2001 at 03:11:29PM -0400, Christian Gross wrote:
> Right now it is this.
> 
> struct apr_lock_t {
>     apr_pool_t *cntxt;
>     apr_locktype_e type;
>     apr_lockscope_e scope;
>     HANDLE mutex;
>     CRITICAL_SECTION section;
>     char *fname;
> };
> 
> Would it not be better to do the following?
> 
> struct apr_lock_t {
>     apr_pool_t *cntxt;
>     apr_locktype_e type;
>     apr_lockscope_e scope;
>     union {
>         HANDLE mutex;
>         CRITICAL_SECTION section;
>     };
>     char *fname;

I thought about that as well for Unix, but I'm not sure what the policy
on unions are in Apache code.  I don't think I've seen them used (I
may very well be wrong).  You might get into issues with size of the
structures, but the compiler might handle that for you (is one structure
larger than another?).  I forget.  K&R *probably* specifies this...  
-- justin


Mime
View raw message