diff options
author | Elias Fleckenstein <54945686+EliasFleckenstein03@users.noreply.github.com> | 2020-11-04 16:44:42 +0100 |
---|---|---|
committer | GitHub <noreply@github.com> | 2020-11-04 16:44:42 +0100 |
commit | 5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc (patch) | |
tree | c980d614fec4a5495798be3e79e033229062c3cd /src/script/cpp_api/s_async.h | |
parent | 28f6a79706b088c37268a59d90878220dc4ef9c7 (diff) | |
parent | 3af10766fd2b58b068e970266724d7eb10e9316b (diff) | |
download | dragonfireclient-5d9ae5a91c544fc7fbd475decf47cef7e09ef8fc.tar.xz |
Merge branch 'master' into master
Diffstat (limited to 'src/script/cpp_api/s_async.h')
-rw-r--r-- | src/script/cpp_api/s_async.h | 14 |
1 files changed, 8 insertions, 6 deletions
diff --git a/src/script/cpp_api/s_async.h b/src/script/cpp_api/s_async.h index b1f4bf45f..1dc4145ba 100644 --- a/src/script/cpp_api/s_async.h +++ b/src/script/cpp_api/s_async.h @@ -31,7 +31,6 @@ with this program; if not, write to the Free Software Foundation, Inc., // Forward declarations class AsyncEngine; - // Declarations // Data required to queue a job @@ -52,9 +51,10 @@ struct LuaJobInfo }; // Asynchronous working environment -class AsyncWorkerThread : public Thread, public ScriptApiBase { +class AsyncWorkerThread : public Thread, public ScriptApiBase +{ public: - AsyncWorkerThread(AsyncEngine* jobDispatcher, const std::string &name); + AsyncWorkerThread(AsyncEngine *jobDispatcher, const std::string &name); virtual ~AsyncWorkerThread(); void *run(); @@ -64,9 +64,11 @@ private: }; // Asynchornous thread and job management -class AsyncEngine { +class AsyncEngine +{ friend class AsyncWorkerThread; typedef void (*StateInitializer)(lua_State *L, int top); + public: AsyncEngine() = default; ~AsyncEngine(); @@ -125,7 +127,7 @@ protected: * @param L Lua stack to initialize * @param top Stack position */ - void prepareEnvironment(lua_State* L, int top); + void prepareEnvironment(lua_State *L, int top); private: // Variable locking the engine against further modification @@ -149,7 +151,7 @@ private: std::deque<LuaJobInfo> resultQueue; // List of current worker threads - std::vector<AsyncWorkerThread*> workerThreads; + std::vector<AsyncWorkerThread *> workerThreads; // Counter semaphore for job dispatching Semaphore jobQueueCounter; |