apr-commits mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From mt...@apache.org
Subject svn commit: r743723 - /apr/apr/trunk/file_io/win32/pipe.c
Date Thu, 12 Feb 2009 13:12:11 GMT
Author: mturk
Date: Thu Feb 12 13:12:10 2009
New Revision: 743723

URL: http://svn.apache.org/viewvc?rev=743723&view=rev
Log:
Add close function for file_socket_pipe. The standard apr_file_close cores

Modified:
    apr/apr/trunk/file_io/win32/pipe.c

Modified: apr/apr/trunk/file_io/win32/pipe.c
URL: http://svn.apache.org/viewvc/apr/apr/trunk/file_io/win32/pipe.c?rev=743723&r1=743722&r2=743723&view=diff
==============================================================================
--- apr/apr/trunk/file_io/win32/pipe.c (original)
+++ apr/apr/trunk/file_io/win32/pipe.c Thu Feb 12 13:12:10 2009
@@ -349,22 +349,9 @@
     return APR_SUCCESS;
 }
 
-#if 0
-/* XXX Do we need this as public API or APR private ?
- * It's main usage is for interrupting pollset because
- * of !APR_FILES_AS_SOCKETS.
- * Duplicating sockets in child requires WSADuplicateSocket
- * and passing WSAPROTOCOL_INFO data to the child, so we
- * would need some sort of IPC instead DuplicateHandle used
- * for files and pipes.
- */
-APR_DECLARE(apr_status_t)
-#else
-apr_status_t
-#endif
-apr_file_socket_pipe_create(apr_file_t **in,
-                            apr_file_t **out,
-                            apr_pool_t *p)
+apr_status_t apr_file_socket_pipe_create(apr_file_t **in,
+                                         apr_file_t **out,
+                                         apr_pool_t *p)
 {
     apr_status_t rv;
     SOCKET rd;
@@ -408,3 +395,20 @@
 
     return rv;
 }
+
+apr_status_t apr_file_socket_pipe_close(apr_file_t *file)
+{
+    apr_status_t stat;
+    if (!file->pipe)
+        return apr_file_close(file);
+    if ((stat = socket_pipe_cleanup(file)) == APR_SUCCESS) {
+        apr_pool_cleanup_kill(file->pool, file, socket_pipe_cleanup);
+
+        if (file->mutex) {
+            apr_thread_mutex_destroy(file->mutex);
+        }
+
+        return APR_SUCCESS;
+    }
+    return stat;
+}



Mime
View raw message