From 7ecf913256fb396e3027aac3318d996a716a52ef Mon Sep 17 00:00:00 2001 From: chai Date: Mon, 25 Oct 2021 23:29:21 +0800 Subject: + job system --- Runtime/FileSystem/FileJobs.cpp | 27 +++++++++++++++++++++++++++ 1 file changed, 27 insertions(+) create mode 100644 Runtime/FileSystem/FileJobs.cpp (limited to 'Runtime/FileSystem/FileJobs.cpp') 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 +#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 -- cgit v1.1-26-g67d0