apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From <...@covalent.net>
Subject Re: [PATCH] allow an APR app to choose underlying lock mechanism
Date Mon, 25 Jun 2001 23:16:10 GMT

> > Would it make more sense to have something that would be more
> > specific to each lock type (mutex, semaphore, read/write locks)?
>
> You tell me :)
>
> I find the whole notion of needing to tell APR which mechanism to use
> fairly klunky, and OS-specific stuff like this really klunky.  Given
> that premise, I don't have a big problem with APR_LOCK_DEFAULT being
> the only thing valid for various platforms and/or lock flavors.

I am beginning to see this is very klunky.  Is there a better way to do
this?  I can't think of one, but this just feels ugly and bad to me.  :-)

Ryan

>
> > [ 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?
>
> You bet!!!!!!!!!!!!!!!!!!! I dunno what I'm doing :)  Also, I need to
> see why it worked (at least I think it did).
>
> --
> Jeff Trawick | trawick@attglobal.net | PGP public key at web site:
>        http://www.geocities.com/SiliconValley/Park/9289/
>              Born in Roswell... married an alien...
>
>


_____________________________________________________________________________
Ryan Bloom                        	rbb@apache.org
Covalent Technologies			rbb@covalent.net
-----------------------------------------------------------------------------


Mime
View raw message