[libgda] pipe() does not exist on Windows



commit 693d4bb165a33dd7d2e8ac20ec6b7d483721cdc7
Author: Vivien Malerba <malerba gnome-db org>
Date:   Tue Jun 7 18:46:51 2011 +0200

    pipe() does not exist on Windows

 libgda/thread-wrapper/gda-thread-wrapper.c |   19 ++++++++++++-------
 1 files changed, 12 insertions(+), 7 deletions(-)
---
diff --git a/libgda/thread-wrapper/gda-thread-wrapper.c b/libgda/thread-wrapper/gda-thread-wrapper.c
index f319187..4e65c2e 100644
--- a/libgda/thread-wrapper/gda-thread-wrapper.c
+++ b/libgda/thread-wrapper/gda-thread-wrapper.c
@@ -115,26 +115,31 @@ pipe_unref (Pipe *p)
 static Pipe *
 pipe_new (void)
 {
-	Pipe *p = g_new0 (Pipe, 1);
+	Pipe *p;
+
+#ifdef G_OS_WIN32
+	p = NULL;
+#else
+	p = g_new0 (Pipe, 1);
 	p->mutex = g_mutex_new ();
 	p->ref_count = 1;
 	p->thread = g_thread_self ();
 	if (pipe (p->fds) != 0) {
 		pipe_unref (p);
-		return NULL;
+		p = NULL;
+		goto out;
 	}
-#ifdef G_OS_WIN32
-	p->ioc = g_io_channel_win32_new_fd (p->fds [0]);
-#else
 	p->ioc = g_io_channel_unix_new (p->fds [0]);
-#endif
 
 	/* we want raw data */
 	if (g_io_channel_set_encoding (p->ioc, NULL, NULL) != G_IO_STATUS_NORMAL) {
 		g_warning ("Can't set IO encoding to NULL\n");
 		pipe_unref (p);
-		return NULL;
+		p = NULL;
 	}
+#endif
+
+ out:
 #ifdef DEBUG_NOTIFICATION
 	g_print ("Created Pipe %p\n", p);
 #endif



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]