apr-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1)" <mad...@hp.com>
Subject RE: [PATCH] Global apr_thread_rwlock
Date Thu, 23 Oct 2003 22:45:49 GMT
Yes. The change can be for APR 1.0 (if it's in the near future :) )

BTW, the patch is not complete - the memory for the pthread_rwlock_t SHOULD
be allocated in a shared memory if we need to have global locks - I was
trying to figure out what is a good place to do the allocation - such that
the user need not be concerned too much about the apr_thread_rwlock_t data
structure.

I was just trying to get a idea if the such a change is welcome in APR :)

Thanks
-Madhu

>-----Original Message-----
>From: William A. Rowe, Jr. [mailto:wrowe@apache.org]
>Sent: Thursday, October 23, 2003 3:15 PM
>To: MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1)
>Cc: 'dev@apr.apache.org'
>Subject: Re: [PATCH] Global apr_thread_rwlock
>
>
>I don't believe we need an _ex flavor if you are proposing 
>this for APR 1.0.
>Just change the args, the 1.0 version may break (expand) our api.
>
>Bill
>
>At 04:24 PM 10/23/2003, MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1) wrote:
>>Hi,
>>        I was wondering if there's any interest in having a 
>option to make
>>the apr_thread_rwlock to support GLOBAL rwlocks. Currently,
>>apr_thread_rwlock exhibits the default pthread behaviour - to 
>be process
>>specific. Since the pthread library gives an option to make 
>it global, can
>>we add it to APR too ?
>>
>>-Madhu
>>
>>--- thread_rwlock.c     Thu Oct 23 14:17:44 2003
>>+++ thread_rwlock.c.g   Thu Oct 23 14:21:12 2003
>>@@ -99,6 +99,53 @@
>>     return APR_SUCCESS;
>> }
>>
>>+APR_DECLARE(apr_status_t) 
>apr_thread_rwlock_create_ex(apr_thread_rwlock_t
>>**rwl
>>ock,
>>+                                                      
>unsigned int flags,
>
>
>where is flags evaluated below?
>
>
>>+                                                      
>apr_pool_t *pool)
>>+{
>>+    apr_thread_rwlock_t *new_rwlock;
>>+    pthread_rwlockattr_t rwattr;
>>+    apr_status_t stat;
>>+
>>+    new_rwlock = apr_palloc(pool, sizeof(apr_thread_rwlock_t));
>>+    new_rwlock->pool = pool;
>>+
>>+    if ((rv = pthread_rwlockattr_init(&rwattr))) {
>>+#ifdef PTHREAD_SETS_ERRNO
>>+        stat = errno;
>>+#endif
>>+        return stat;
>>+    }
>>+
>>+    if ((rv = pthread_rwlockattr_setpshared(&rwattr,
>>PTHREAD_PROCESS_SHARED)))
>>{
>>+#ifdef PTHREAD_SETS_ERRNO
>>+        stat = errno;
>>+#endif
>>+        return stat;
>>+    }
>>+
>>+    if ((stat = pthread_rwlock_init(&new_rwlock->rwlock, &rwattr))) {
>>+#ifdef PTHREAD_SETS_ERRNO
>>+        stat = errno;
>>+#endif
>>+        return stat;
>>+    }
>>+
>>+    if ((rv = pthread_rwlockattr_destroy(&rwattr))) {
>>+#ifdef PTHREAD_SETS_ERRNO
>>+        stat = errno;
>>+#endif
>>+        return stat;
>>+    }
>>+
>>+    apr_pool_cleanup_register(new_rwlock->pool,
>>+                              (void *)new_rwlock, 
>thread_rwlock_cleanup,
>>+                              apr_pool_cleanup_null);
>>+
>>+    *rwlock = new_rwlock;
>>+    return APR_SUCCESS;
>>+}
>>+
>> APR_DECLARE(apr_status_t) 
>apr_thread_rwlock_rdlock(apr_thread_rwlock_t
>>*rwlock)
>> {
>>     apr_status_t stat;
>

Mime
View raw message