summaryrefslogtreecommitdiff
path: root/includes
diff options
context:
space:
mode:
Diffstat (limited to 'includes')
-rw-r--r--includes/Task.h12
-rw-r--r--includes/TaskMan.h6
2 files changed, 17 insertions, 1 deletions
diff --git a/includes/Task.h b/includes/Task.h
index 042624d..b124731 100644
--- a/includes/Task.h
+++ b/includes/Task.h
@@ -1,7 +1,9 @@
#pragma once
#include <stdlib.h>
+#ifndef _WIN32
#include <coro.h>
+#endif
#include <ev++.h>
#include <vector>
#include <Exceptions.h>
@@ -81,6 +83,10 @@ class Async : public BaseEvent {
ev::async m_evt;
};
+#ifndef _WIN32
+#define CALLBACK
+#endif
+
class Custom : public BaseEvent {
public:
void doSignal() { BaseEvent::doSignal(); ev_break(m_loop, EVBREAK_ALL); }
@@ -137,9 +143,13 @@ class Task {
private:
size_t stackSize() { return 128 * 1024; }
void switchTo();
- static void coroutine(void *);
+ static void CALLBACK coroutine(void *);
void * m_stack;
+#ifndef _WIN32
coro_context m_ctx;
+#else
+ void * m_fiber;
+#endif
TaskMan * m_taskMan;
Status m_status;
void * m_tls;
diff --git a/includes/TaskMan.h b/includes/TaskMan.h
index 8144e93..ad19f65 100644
--- a/includes/TaskMan.h
+++ b/includes/TaskMan.h
@@ -1,7 +1,9 @@
#pragma once
#include <stdint.h>
+#ifndef _WIN32
#include <coro.h>
+#endif
#include <ev++.h>
#include <ext/hash_set>
#include <vector>
@@ -26,7 +28,11 @@ class TaskMan {
private:
void registerTask(Task * t);
void unregisterTask(Task * t);
+#ifndef _WIN32
coro_context m_returnContext;
+#else
+ void * m_fiber;
+#endif
friend class Task;
struct taskHasher { size_t operator()(const Task * t) const { return reinterpret_cast<uintptr_t>(t); } };
typedef gnu::hash_set<Task *, taskHasher> taskHash_t;