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; |
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; |
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 */ |
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 ? |
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) { |