summaryrefslogtreecommitdiff
path: root/source/libs/asura-lib-core/threading
diff options
context:
space:
mode:
Diffstat (limited to 'source/libs/asura-lib-core/threading')
-rw-r--r--source/libs/asura-lib-core/threading/coroutine.cpp0
-rw-r--r--source/libs/asura-lib-core/threading/coroutine.h31
-rw-r--r--source/libs/asura-lib-core/threading/thread.cpp0
-rw-r--r--source/libs/asura-lib-core/threading/thread.h53
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_posix.cpp0
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_posix.h0
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_sdl.cpp0
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_sdl.h0
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_std.cpp0
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_std.h0
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_win32.cpp0
-rw-r--r--source/libs/asura-lib-core/threading/thread_impl_win32.h25
-rw-r--r--source/libs/asura-lib-core/threading/thread_task.cpp0
-rw-r--r--source/libs/asura-lib-core/threading/thread_task.h25
14 files changed, 134 insertions, 0 deletions
diff --git a/source/libs/asura-lib-core/threading/coroutine.cpp b/source/libs/asura-lib-core/threading/coroutine.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/coroutine.cpp
diff --git a/source/libs/asura-lib-core/threading/coroutine.h b/source/libs/asura-lib-core/threading/coroutine.h
new file mode 100644
index 0000000..1ac6b21
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/coroutine.h
@@ -0,0 +1,31 @@
+#ifndef __ASURA_COROUTINE_H__
+#define __ASURA_COROUTINE_H__
+
+#include <asura-lib-utils/scripting/portable.hpp>
+
+namespace AsuraEngine
+{
+ namespace Threading
+ {
+
+ ///
+ /// luaЭ̣һЩ߼
+ ///
+ class Coroutine ASURA_FINAL
+ : public AEScripting::Portable<Coroutine>
+ {
+ public:
+
+ LUAX_DECL_FACTORY(Coroutine);
+
+ private:
+
+ LUAX_DECL_METHOD(_New);
+ LUAX_DECL_METHOD(_Run);
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/libs/asura-lib-core/threading/thread.cpp b/source/libs/asura-lib-core/threading/thread.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread.cpp
diff --git a/source/libs/asura-lib-core/threading/thread.h b/source/libs/asura-lib-core/threading/thread.h
new file mode 100644
index 0000000..f4d3b48
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread.h
@@ -0,0 +1,53 @@
+#ifndef __ASURA_THREAD_H__
+#define __ASURA_THREAD_H__
+
+#include <queue>
+#include <asura-lib-utils/scripting/portable.hpp>
+
+#include "thread_task.h"
+
+namespace AsuraEngine
+{
+ namespace Threading
+ {
+
+ ///
+ /// ̵߳ľʵ֣û͸ģһ׼ֲԣ
+ /// 1: win32
+ /// 2: posix
+ /// 3: SDL
+ /// 4: std::thread
+ ///
+ ASURA_ABSTRACT class ThreadImpl
+ {
+ public:
+
+ };
+
+ ///
+ /// ߳壬ÿ߳άһtask queue
+ ///
+ class Thread ASURA_FINAL
+ : public AEScripting::Portable<Thread>
+ {
+ public:
+
+ LUAX_DECL_FACTORY(Thread);
+
+ bool Enqueue(ThreadTask* task);
+
+ private:
+
+ ///
+ /// С
+ ///
+ std::queue<ThreadTask*> mTaskQueue;
+
+ ThreadImpl* mImpl;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file
diff --git a/source/libs/asura-lib-core/threading/thread_impl_posix.cpp b/source/libs/asura-lib-core/threading/thread_impl_posix.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_posix.cpp
diff --git a/source/libs/asura-lib-core/threading/thread_impl_posix.h b/source/libs/asura-lib-core/threading/thread_impl_posix.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_posix.h
diff --git a/source/libs/asura-lib-core/threading/thread_impl_sdl.cpp b/source/libs/asura-lib-core/threading/thread_impl_sdl.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_sdl.cpp
diff --git a/source/libs/asura-lib-core/threading/thread_impl_sdl.h b/source/libs/asura-lib-core/threading/thread_impl_sdl.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_sdl.h
diff --git a/source/libs/asura-lib-core/threading/thread_impl_std.cpp b/source/libs/asura-lib-core/threading/thread_impl_std.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_std.cpp
diff --git a/source/libs/asura-lib-core/threading/thread_impl_std.h b/source/libs/asura-lib-core/threading/thread_impl_std.h
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_std.h
diff --git a/source/libs/asura-lib-core/threading/thread_impl_win32.cpp b/source/libs/asura-lib-core/threading/thread_impl_win32.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_win32.cpp
diff --git a/source/libs/asura-lib-core/threading/thread_impl_win32.h b/source/libs/asura-lib-core/threading/thread_impl_win32.h
new file mode 100644
index 0000000..5d854cc
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_impl_win32.h
@@ -0,0 +1,25 @@
+#ifndef __ASURA_THREAD_WIN32_H__
+#define __ASURA_THREAD_WIN32_H__
+
+#include "../core_config.h"
+
+#include "thread.h"
+
+#if ASURA_THREAD_WIN32
+
+namespace AsuraEngine
+{
+ namespace Threading
+ {
+
+ class ThreadImplWin32 : public ThreadImpl
+ {
+
+ };
+
+ }
+}
+
+#endif // #if ASURA_THREAD_WIN32
+
+#endif \ No newline at end of file
diff --git a/source/libs/asura-lib-core/threading/thread_task.cpp b/source/libs/asura-lib-core/threading/thread_task.cpp
new file mode 100644
index 0000000..e69de29
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_task.cpp
diff --git a/source/libs/asura-lib-core/threading/thread_task.h b/source/libs/asura-lib-core/threading/thread_task.h
new file mode 100644
index 0000000..19eb113
--- /dev/null
+++ b/source/libs/asura-lib-core/threading/thread_task.h
@@ -0,0 +1,25 @@
+#ifndef __ASURA_THRAD_TASK_H__
+#define __ASURA_THRAD_TASK_H__
+
+#include <asura-lib-utils/type.h>
+
+namespace AsuraEngine
+{
+ namespace Threading
+ {
+
+ ///
+ /// ϣһ̴߳񣬼̳TaskдExecute
+ ///
+ ASURA_ABSTRACT class ThreadTask
+ {
+ public:
+
+ virtual bool Execute() = 0;
+
+ };
+
+ }
+}
+
+#endif \ No newline at end of file