summaryrefslogtreecommitdiff
path: root/includes/Task.h
diff options
context:
space:
mode:
authorPixel <pixel@nobis-crew.org>2011-10-18 16:37:49 -0700
committerPixel <pixel@nobis-crew.org>2011-10-18 16:37:49 -0700
commit0db120afdfb818421dc5df3dc0946fafede78c93 (patch)
treee47403f57bcc39471d6c994c4f2951f4eb9ba108 /includes/Task.h
parent4e07ceeb21dae4b6b8d5eaf7421228f735f14bda (diff)
libcoro seems to be doing really spurious things when not using the standard functions.
Switching out libcoro for the native Fibers interface for Win32. Switching out the asm version for the ucontext version for Linux.
Diffstat (limited to 'includes/Task.h')
-rw-r--r--includes/Task.h12
1 files changed, 11 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;