ViewVC Help
View File | Revision Log | Show Annotations | Download File | View Changeset | Root Listing
root/src/vendor/apache/apr/dist/file_io/win32/readwrite.c
(Generate patch)

Comparing vendor/apache/apr/dist/file_io/win32/readwrite.c (file contents):
Revision 9272 by laffer1, Mon Feb 20 03:04:01 2017 UTC vs.
Revision 9273 by laffer1, Mon Feb 20 03:07:37 2017 UTC

# Line 181 | Line 181 | APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *th
181          apr_size_t blocksize;
182          apr_size_t size = *len;
183  
184 <        apr_thread_mutex_lock(thefile->mutex);
184 >        if (thefile->flags & APR_FOPEN_XTHREAD) {
185 >            apr_thread_mutex_lock(thefile->mutex);
186 >        }
187  
188          if (thefile->direction == 1) {
189              rv = apr_file_flush(thefile);
190              if (rv != APR_SUCCESS) {
191 <                apr_thread_mutex_unlock(thefile->mutex);
191 >                if (thefile->flags & APR_FOPEN_XTHREAD) {
192 >                    apr_thread_mutex_unlock(thefile->mutex);
193 >                }
194                  return rv;
195              }
196              thefile->bufpos = 0;
# Line 223 | Line 227 | APR_DECLARE(apr_status_t) apr_file_read(apr_file_t *th
227          if (*len) {
228              rv = APR_SUCCESS;
229          }
230 <        apr_thread_mutex_unlock(thefile->mutex);
230 >
231 >        if (thefile->flags & APR_FOPEN_XTHREAD) {
232 >            apr_thread_mutex_unlock(thefile->mutex);
233 >        }
234      } else {  
235          /* Unbuffered i/o */
236          apr_size_t nbytes;
# Line 260 | Line 267 | APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *t
267          apr_size_t blocksize;
268          apr_size_t size = *nbytes;
269  
270 <        apr_thread_mutex_lock(thefile->mutex);
270 >        if (thefile->flags & APR_FOPEN_XTHREAD) {
271 >            apr_thread_mutex_lock(thefile->mutex);
272 >        }
273  
274          if (thefile->direction == 0) {
275              /* Position file pointer for writing at the offset we are logically reading from */
# Line 275 | Line 284 | APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *t
284  
285          rv = 0;
286          while (rv == 0 && size > 0) {
287 <            if (thefile->bufpos == thefile->bufsize)   // write buffer is full
287 >            if (thefile->bufpos == thefile->bufsize)   /* write buffer is full */
288                  rv = apr_file_flush(thefile);
289  
290              blocksize = size > thefile->bufsize - thefile->bufpos ?
# Line 286 | Line 295 | APR_DECLARE(apr_status_t) apr_file_write(apr_file_t *t
295              size -= blocksize;
296          }
297  
298 <        apr_thread_mutex_unlock(thefile->mutex);
298 >        if (thefile->flags & APR_FOPEN_XTHREAD) {
299 >            apr_thread_mutex_unlock(thefile->mutex);
300 >        }
301          return rv;
302      } else {
303          if (!thefile->pipe) {

Diff Legend

Removed lines
+ Added lines
< Changed lines
> Changed lines