You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@apr.apache.org by Justin Erenkrantz <je...@ebuilt.com> on 2001/05/01 01:13:30 UTC

Re: [PATCH] RW lock Iteration 2 for Windows

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