From dev-return-10501-apmail-apr-dev-archive=apr.apache.org@apr.apache.org Thu Oct 23 22:18:52 2003 Return-Path: Delivered-To: apmail-apr-dev-archive@www.apache.org Received: (qmail 16573 invoked from network); 23 Oct 2003 22:18:52 -0000 Received: from daedalus.apache.org (HELO mail.apache.org) (208.185.179.12) by minotaur-2.apache.org with SMTP; 23 Oct 2003 22:18:52 -0000 Received: (qmail 1034 invoked by uid 500); 23 Oct 2003 22:18:37 -0000 Delivered-To: apmail-apr-dev-archive@apr.apache.org Received: (qmail 843 invoked by uid 500); 23 Oct 2003 22:18:36 -0000 Mailing-List: contact dev-help@apr.apache.org; run by ezmlm Precedence: bulk List-Post: List-Help: List-Unsubscribe: List-Subscribe: Delivered-To: mailing list dev@apr.apache.org Received: (qmail 826 invoked from network); 23 Oct 2003 22:18:36 -0000 Message-Id: <5.2.0.9.2.20031023171441.0312beb0@pop3.rowe-clan.net> X-Sender: admin%rowe-clan.net@pop3.rowe-clan.net (Unverified) X-Mailer: QUALCOMM Windows Eudora Version 5.2.0.9 Date: Thu, 23 Oct 2003 17:14:59 -0500 To: "MATHIHALLI,MADHUSUDAN (HP-Cupertino,ex1)" From: "William A. Rowe, Jr." Subject: Re: [PATCH] Global apr_thread_rwlock Cc: "'dev@apr.apache.org'" In-Reply-To: <1FE4AC40A0D4DA47B9E84CE8F266CB7F03055432@xsun04.ptp.hp.com > Mime-Version: 1.0 Content-Type: text/plain; charset="us-ascii" X-OriginalArrivalTime: 23 Oct 2003 22:16:33.0623 (UTC) FILETIME=[51274670:01C399B3] X-Spam-Rating: daedalus.apache.org 1.6.2 0/1000/N X-Spam-Rating: minotaur-2.apache.org 1.6.2 0/1000/N 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;