summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--includes/Local.h4
-rw-r--r--mingw32-config.h33
-rw-r--r--src/TaskMan.cc14
3 files changed, 49 insertions, 2 deletions
diff --git a/includes/Local.h b/includes/Local.h
index 79862a6..6a598ab 100644
--- a/includes/Local.h
+++ b/includes/Local.h
@@ -26,14 +26,14 @@ class Local : public AtStart {
void set(void * obj) { void * r = getTLS(); if (r) setLocal(obj); else setGlobal(obj); }
int getIndex() { return m_idx; }
private:
- static void * create() { void * r = malloc(s_size * sizeof(void *)); return r; }
+ static void * create() { void * r = calloc(s_size * sizeof(void *), 1); return r; }
static void * getTLS() { return g_tlsManager->getTLS(); }
static void * setTLS(void * val) { return g_tlsManager->setTLS(val); }
virtual void doStart();
int m_idx;
static int s_size;
static void ** m_globals;
-
+
friend class TLSManager;
};
diff --git a/mingw32-config.h b/mingw32-config.h
new file mode 100644
index 0000000..bc6f2ab
--- /dev/null
+++ b/mingw32-config.h
@@ -0,0 +1,33 @@
+#define HAVE_PROPER_ICONV 1
+
+#define __CLEANUP_C 1
+#define PTW32_BUILD_INLINED 1
+#define PTW32_STATIC_LIB 1
+#define HAVE_PTW32_CONFIG_H 1
+
+#define PIC 1
+
+#define STDC_HEADERS 1
+#define WORDS_LITTLEENDIAN 1
+#define CORO_LOSER 1
+#define _FILE_OFFSET_BITS 64
+#define EMBED_LIBEIO
+
+#ifndef _GNU_SOURCE
+#define _GNU_SOURCE 1
+#endif
+
+
+#define EV_STANDALONE 1
+
+#define HAVE_INTTYPES_H 1
+#define HAVE_MEMORY_H 1
+#define HAVE_STDINT_H 1
+#define HAVE_STDLIB_H 1
+#define HAVE_STRINGS_H 1
+#define HAVE_STRING_H 1
+#define HAVE_SYS_STAT_H 1
+#define HAVE_SYS_TYPES_H 1
+#define HAVE_UNISTD_H 1
+
+#define HAVE_FLOOR 1
diff --git a/src/TaskMan.cc b/src/TaskMan.cc
index ea9c0fb..3b715ce 100644
--- a/src/TaskMan.cc
+++ b/src/TaskMan.cc
@@ -16,6 +16,20 @@ Balau::TaskMan::TaskMan() : m_stopped(false) {
}
}
+#ifdef _WIN32
+class WinSocketStartup : public Balau::AtStart {
+ public:
+ WinSocketStartup() : AtStart(5) { }
+ virtual void doStart() {
+ WSADATA wsaData;
+ int r = WSAStartup(MAKEWORD(2, 0), &wsaData);
+ Assert(r == 0);
+ }
+};
+
+static WinSocketStartup wsa;
+#endif
+
Balau::TaskMan * Balau::TaskMan::getTaskMan() { return localTaskMan.get(); }
Balau::TaskMan::~TaskMan() {