Return-Path: Delivered-To: apmail-httpd-modules-dev-archive@minotaur.apache.org Received: (qmail 47967 invoked from network); 13 Mar 2009 23:40:50 -0000 Received: from hermes.apache.org (HELO mail.apache.org) (140.211.11.2) by minotaur.apache.org with SMTP; 13 Mar 2009 23:40:50 -0000 Received: (qmail 63862 invoked by uid 500); 13 Mar 2009 23:40:49 -0000 Delivered-To: apmail-httpd-modules-dev-archive@httpd.apache.org Received: (qmail 63846 invoked by uid 500); 13 Mar 2009 23:40:49 -0000 Mailing-List: contact modules-dev-help@httpd.apache.org; run by ezmlm Precedence: bulk List-Help: List-Unsubscribe: List-Post: List-Id: Reply-To: modules-dev@httpd.apache.org Delivered-To: mailing list modules-dev@httpd.apache.org Received: (qmail 63835 invoked by uid 99); 13 Mar 2009 23:40:49 -0000 Received: from athena.apache.org (HELO athena.apache.org) (140.211.11.136) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Mar 2009 16:40:49 -0700 X-ASF-Spam-Status: No, hits=2.2 required=10.0 tests=HTML_MESSAGE,SPF_PASS X-Spam-Check-By: apache.org Received-SPF: pass (athena.apache.org: domain of andrejvanderzee@gmail.com designates 209.85.200.173 as permitted sender) Received: from [209.85.200.173] (HELO wf-out-1314.google.com) (209.85.200.173) by apache.org (qpsmtpd/0.29) with ESMTP; Fri, 13 Mar 2009 23:40:42 +0000 Received: by wf-out-1314.google.com with SMTP id 27so2054033wfd.15 for ; Fri, 13 Mar 2009 16:40:22 -0700 (PDT) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=domainkey-signature:mime-version:received:in-reply-to:references :date:message-id:subject:from:to:content-type; bh=gaXs1nNbZO81XPX8p4GiqhlOf4jP/Ral9uIHOXLNBtQ=; b=Z10/9TouLqDdweaNwA63fKysc/0+7RkKYR13R2lbYthpu4d3HW3aC9ix/VBA6pFnWy 5akkZPeVsl4hVQEVXVwW87pYwNC1jF7HCzf6OBGqfwr0vtfE5q3y6XXffaXI6xjoIdL9 ArSGrb4UgGqK50ZTgmlykxDYlWLpiwEfmHsbk= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type; b=PlhIPcSHXGPJr/uoW/t+mQbPdXaY3R7S9uuG/D7+q54T8iPOOv702c/gHGOTDN/MH/ Ggsluc3kp95yKsZjHQhTbaem4hjwTt1CCtWOMnTGIegsQFX/xEgaZl6fBr5+NwAN4Elw /EdUmb/YzVTVIMX/gYCHo9ngpGXvy1qcETUm8= MIME-Version: 1.0 Received: by 10.142.194.1 with SMTP id r1mr884241wff.122.1236987622357; Fri, 13 Mar 2009 16:40:22 -0700 (PDT) In-Reply-To: <49BA867A.7060805@gmail.com> References: <6456355d0903101808i23c73db6u544a7b8a16f0e3bb@mail.gmail.com> <20170a030903110108w23622fd7sa9f417f3e11e3f52@mail.gmail.com> <49B77326.6040602@gmail.com> <6456355d0903130018o7d97e865h2343eb84fdf1408f@mail.gmail.com> <49BA7EC0.7030309@gmail.com> <6456355d0903130856x27a22369vfde69b012d19e6d8@mail.gmail.com> <49BA867A.7060805@gmail.com> Date: Sat, 14 Mar 2009 08:40:22 +0900 Message-ID: <6456355d0903131640w19d173adl1d58b14ae888157a@mail.gmail.com> Subject: Re: custom background thread and module sharing a data structure From: Andrej van der Zee To: modules-dev@httpd.apache.org Content-Type: multipart/alternative; boundary=000e0cd14ed8d27da40465089fcf X-Virus-Checked: Checked by ClamAV on apache.org --000e0cd14ed8d27da40465089fcf Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: 7bit Hi, > My point is that within a single process, multiple threads can service > requests that can end up firing your module code. If you only do process > locking you can still have more than 1 thread executing your module code at > the same time. > > Just a process level lock will *not* guarantee that only a single thread is > executing your code within the process holding the lock. A inter thread lock > is needed to synchronize multiple threads within that processes from > stomping on a shared resource. > > Yeah you are right, two thread in the same process in the mpm worker model still execute the same code to access the shared inter-process resource. So I guess I need to add the thread-based mutexes within a APR_HAS_THREADS define, like in some other modules I have seen. Thanks for clearing this up! Cheers, Andrej --000e0cd14ed8d27da40465089fcf--