summaryrefslogtreecommitdiff
path: root/Runtime/FileSystem/FileJobs.cpp
diff options
context:
space:
mode:
authorchai <chaifix@163.com>2021-10-25 23:29:21 +0800
committerchai <chaifix@163.com>2021-10-25 23:29:21 +0800
commit7ecf913256fb396e3027aac3318d996a716a52ef (patch)
tree4540835c881a63b665e2a692bf30115fd29e8bb0 /Runtime/FileSystem/FileJobs.cpp
parent0816cd70ca1a213b6ed872bcf3c0bf0912473722 (diff)
+ job system
Diffstat (limited to 'Runtime/FileSystem/FileJobs.cpp')
-rw-r--r--Runtime/FileSystem/FileJobs.cpp27
1 files changed, 27 insertions, 0 deletions
diff --git a/Runtime/FileSystem/FileJobs.cpp b/Runtime/FileSystem/FileJobs.cpp
new file mode 100644
index 0000000..29e99a4
--- /dev/null
+++ b/Runtime/FileSystem/FileJobs.cpp
@@ -0,0 +1,27 @@
+#include <fstream>
+#include "FileJobs.h"
+
+using namespace std;
+
+void ReadFilesJob::Dispacth(void* param)
+{
+ LUA_BIND_STATE((lua_State*)param);
+ if (!callback)
+ return;
+ callback.PushRef(state);
+ state.Call(0, 0);
+}
+
+void ReadFilesJob::Process()
+{
+ if (IsFinished())
+ return;
+ ifstream infile;
+ infile.open(files[cur]);
+ ++cur;
+}
+
+bool ReadFilesJob::IsFinished()
+{
+ return cur >= files.size();
+} \ No newline at end of file