httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From "Brian Havard" <bri...@kheldar.apana.org.au>
Subject Re: Buffered file I/O & thread safety
Date Mon, 12 Jun 2000 12:12:32 GMT
On Sun, 11 Jun 2000 15:11:11 -0500, Manoj Kasichainula wrote:

>On Sun, Jun 11, 2000 at 11:07:28PM +1000, Brian Havard wrote:
>> In the case of mod_include or config file reading only 1 thread will ever
>> touch the ap_file_t so a serious speed boost can be achieved by turning off
>> the locking. To this end I propose adding a flag value for ap_open() to
>> indicate if the handle needs to be thread safe, say APR_MT.
>
>Tons of flag checking can make the code harder to read IMO. What the
>Linux kernel does is to provide an unlocked version of a call, and
>then make the locked version wrap that.

Err, considering that the calls actuall affected are ap_read & ap_write
that would require finding & changing all occurances of those calls. I much
prefer a single flag change to ap_open. It aint 'Tons' of flag checking,
just one. Is this so hard to read?

--- lib/apr/file_io/os2/readwrite.c	2000/05/27 18:01:00	1.27
+++ lib/apr/file_io/os2/readwrite.c	2000/06/11 07:01:44
@@ -77,7 +77,8 @@
         ULONG blocksize;
         ULONG size = *nbytes;
 
-        ap_lock(thefile->mutex);
+        if (thefile->flags & APR_MT)
+            ap_lock(thefile->mutex);
 
         if (thefile->direction == 1) {
             ap_flush(thefile);

-- 
 ______________________________________________________________________________
 |  Brian Havard                 |  "He is not the messiah!                   |
 |  brianh@kheldar.apana.org.au  |  He's a very naughty boy!" - Life of Brian |
 ------------------------------------------------------------------------------


Mime
View raw message