mirror of
https://github.com/luanti-org/luanti.git
synced 2025-06-27 16:36:03 +00:00
Async environment for mods to do concurrent tasks (#11131)
This commit is contained in:
parent
663c936428
commit
e7659883cc
38 changed files with 1646 additions and 48 deletions
|
@ -27,6 +27,9 @@ with this program; if not, write to the Free Software Foundation, Inc.,
|
|||
#include "cpp_api/s_player.h"
|
||||
#include "cpp_api/s_server.h"
|
||||
#include "cpp_api/s_security.h"
|
||||
#include "cpp_api/s_async.h"
|
||||
|
||||
struct PackedValue;
|
||||
|
||||
/*****************************************************************************/
|
||||
/* Scripting <-> Server Game Interface */
|
||||
|
@ -48,6 +51,20 @@ public:
|
|||
|
||||
// use ScriptApiBase::loadMod() to load mods
|
||||
|
||||
// Initialize async engine, call this AFTER loading all mods
|
||||
void initAsync();
|
||||
|
||||
// Global step handler to collect async results
|
||||
void stepAsync();
|
||||
|
||||
// Pass job to async threads
|
||||
u32 queueAsync(std::string &&serialized_func,
|
||||
PackedValue *param, const std::string &mod_origin);
|
||||
|
||||
private:
|
||||
void InitializeModApi(lua_State *L, int top);
|
||||
|
||||
static void InitializeAsync(lua_State *L, int top);
|
||||
|
||||
AsyncEngine asyncEngine;
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue