]> git.tdb.fi Git - libs/core.git/blobdiff - source/event.cpp
Win32 tweaks
[libs/core.git] / source / event.cpp
index b314fca1730543c0697bfd4abd6f11e8572e1a10..01b8542a6225c2d0fb7cd703e4bb32d93283ce32 100644 (file)
@@ -3,6 +3,11 @@ This file is part of libmspframework
 Copyright © 2006 Mikko Rasa, Mikkosoft Productions
 Distributed under the LGPL
 */
+#ifdef WIN32
+#include <io.h>
+#include <fcntl.h>
+#endif
+
 #include "application.h"
 #include "event.h"
 
@@ -42,17 +47,29 @@ void EventManager::Event::trigger()
 
 EventManager::Pipe::Pipe()
 {
+#ifdef WIN32
+       _pipe(fd, 1024, _O_BINARY);
+#else
        ::pipe(fd);
+#endif
 }
 
 int EventManager::Pipe::write(char *buf, unsigned len)
 {
+#ifdef WIN32
+       return _write(fd[1], buf, len);
+#else
        return ::write(fd[1], buf, len);
+#endif
 }
 
 int EventManager::Pipe::read(char *buf, unsigned len)
 {
+#ifdef WIN32
+       return _read(fd[0], buf, len);
+#else
        return ::read(fd[0], buf, len);
+#endif
 }
 
 } // namespace Msp