summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorStas Bekman <stas@apache.org>2004-09-24 23:15:38 +0000
committerStas Bekman <stas@apache.org>2004-09-24 23:15:38 +0000
commit39827ace4d2bec88f4d95c5915655f0c92c5ed1d (patch)
tree2f7bcbc5be3799ec30a6a992e73202c903080a35
parent7cf0798a5fc7e5dda6e6d5e94e0b547ff7e479f8 (diff)
downloadapr-39827ace4d2bec88f4d95c5915655f0c92c5ed1d.tar.gz
fix apr_file_dup and apr_file_dup2 win32 implementations
to create a mutex PR: Obtained from: Submitted by: Steve Hay <steve.hay uk.radan.com> Reviewed by: stas git-svn-id: https://svn.apache.org/repos/asf/apr/apr/branches/APR_0_9_BRANCH@65349 13f79535-47bb-0310-9956-ffa450edef68
-rw-r--r--CHANGES3
-rw-r--r--file_io/win32/filedup.c14
2 files changed, 17 insertions, 0 deletions
diff --git a/CHANGES b/CHANGES
index de5d8829c..b1b645eda 100644
--- a/CHANGES
+++ b/CHANGES
@@ -1,5 +1,8 @@
Changes with APR 0.9.5
+ *) fix apr_file_dup and apr_file_dup2 win32 implementations
+ to create a mutex [Steve Hay <steve.hay uk.radan.com>]
+
*) Makes the threads to behave like on posix. If the thread is created
without APR_DETACH expect that the thread_join will be called, so don't
close the handle in advance, if the thread has already finished.
diff --git a/file_io/win32/filedup.c b/file_io/win32/filedup.c
index c6fa99142..851e9c8c7 100644
--- a/file_io/win32/filedup.c
+++ b/file_io/win32/filedup.c
@@ -44,6 +44,13 @@ APR_DECLARE(apr_status_t) apr_file_dup(apr_file_t **new_file,
(*new_file)->buffered = FALSE;
(*new_file)->ungetchar = old_file->ungetchar;
+#if APR_HAS_THREADS
+ if (old_file->mutex) {
+ apr_thread_mutex_create(&((*new_file)->mutex),
+ APR_THREAD_MUTEX_DEFAULT, p);
+ }
+#endif
+
apr_pool_cleanup_register((*new_file)->pool, (void *)(*new_file), file_cleanup,
apr_pool_cleanup_null);
@@ -114,6 +121,13 @@ APR_DECLARE(apr_status_t) apr_file_dup2(apr_file_t *new_file,
new_file->buffered = FALSE;
new_file->ungetchar = old_file->ungetchar;
+#if APR_HAS_THREADS
+ if (old_file->mutex) {
+ apr_thread_mutex_create(&(new_file->mutex),
+ APR_THREAD_MUTEX_DEFAULT, p);
+ }
+#endif
+
return APR_SUCCESS;
#endif /* !defined(_WIN32_WCE) */
}