diff options
author | bojan <bojan@13f79535-47bb-0310-9956-ffa450edef68> | 2007-05-13 05:00:33 +0000 |
---|---|---|
committer | bojan <bojan@13f79535-47bb-0310-9956-ffa450edef68> | 2007-05-13 05:00:33 +0000 |
commit | db36b7dd8992aec53b52811ff48b9e894402c96e (patch) | |
tree | 1c88d43fefea06d797d6232319c930d4db12f18a /include | |
parent | d2cb40c630ce9672e0d6455bf7a5293e366157bb (diff) | |
download | libapr-db36b7dd8992aec53b52811ff48b9e894402c96e.tar.gz |
Backport r537393, r537402 and r537405 from the trunk.
Improve thread safety of assorted file_io functions.
Patches by Davi Arnaut.
git-svn-id: http://svn.apache.org/repos/asf/apr/apr/branches/0.9.x@537554 13f79535-47bb-0310-9956-ffa450edef68
Diffstat (limited to 'include')
-rw-r--r-- | include/arch/unix/apr_arch_file_io.h | 14 |
1 files changed, 14 insertions, 0 deletions
diff --git a/include/arch/unix/apr_arch_file_io.h b/include/arch/unix/apr_arch_file_io.h index 3906b7cf5..e3c089152 100644 --- a/include/arch/unix/apr_arch_file_io.h +++ b/include/arch/unix/apr_arch_file_io.h @@ -104,6 +104,20 @@ struct apr_file_t { #endif }; +#if APR_HAS_THREADS +#define file_lock(f) do { \ + if ((f)->thlock) \ + apr_thread_mutex_lock((f)->thlock); \ + } while (0) +#define file_unlock(f) do { \ + if ((f)->thlock) \ + apr_thread_mutex_unlock((f)->thlock); \ + } while (0) +#else +#define file_lock(f) do {} while (0) +#define file_unlock(f) do {} while (0) +#endif + struct apr_dir_t { apr_pool_t *pool; char *dirname; |