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] allow an APR app to choose underlying lock mechanism
Date Mon, 25 Jun 2001 20:45:34 GMT
On Mon, Jun 25, 2001 at 04:30:45PM -0400, Jeff Trawick wrote:
> Did anybody want this done differently?

What about Read/write locks?  Those would use the same function for
creation, but none of the values for the methods would be valid
(except the DEFAULT).

Would it make more sense to have something that would be more 
specific to each lock type (mutex, semaphore, read/write locks)?

[ See one note about the patch below...]

> Index: test/testlock.c
> ===================================================================
> RCS file: /home/cvs/apr/test/testlock.c,v
> retrieving revision 1.3
> diff -u -r1.3 testlock.c
> --- test/testlock.c	2001/06/06 22:25:43	1.3
> +++ test/testlock.c	2001/06/25 20:27:22
> @@ -143,7 +143,7 @@
>      printf("RW Lock Tests\n");
>      printf("%-60s", "    Initializing the RW lock");
>      s1 = apr_lock_create(&thread_rw_lock, APR_READWRITE, APR_INTRAPROCESS,
> -                         "lock.file", pool);
> +                         APR_LOCK_CREATE, "lock.file", pool);
>      if (s1 != APR_SUCCESS) {
>          printf("Failed!\n");
>          return s1;
> @@ -191,7 +191,7 @@
>      printf("Exclusive lock test\n");
>      printf("%-60s", "    Initializing the lock");
>      s1 = apr_lock_create(&thread_lock, APR_MUTEX, APR_INTRAPROCESS, 
> -                         "lock.file", pool); 
> +                         APR_LOCK_CREATE, "lock.file", pool); 
>  
>      if (s1 != APR_SUCCESS) {
>          printf("Failed!\n");
> @@ -239,8 +239,8 @@
>   
>      printf("Testing multiple locking\n");
>      printf("%-60s","    Creating the lock we'll use");
> -    if ((rv = apr_lock_create(&multi, APR_MUTEX, APR_LOCKALL,"multi.lock",
> -                        pool)) != APR_SUCCESS) {
> +    if ((rv = apr_lock_create(&multi, APR_MUTEX, APR_LOCKALL,APR_LOCK_CREATE,
> +                              "multi.lock", pool)) != APR_SUCCESS) {
>          printf("Failed!\n");
>          return rv;
>      }

Shouldn't these be APR_LOCK_DEFAULT, or am I missing something?  
-- justin


Mime
View raw message