mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-14 00:55:20 +02:00
Add API to cancel async jobs (#14602)
* Implement API to cancel async jobs Co-authored-by: sfan5 <sfan5@live.de> * update AsyncJob:cancel documentation from review * Use IPC to unblock async * review * review async unblocking * review * Apply suggestions from code review Co-authored-by: sfan5 <sfan5@live.de> * minor licensing --------- Co-authored-by: y5nw <y5nw@protonmail.com> Co-authored-by: sfan5 <sfan5@live.de>
This commit is contained in:
@@ -22,6 +22,7 @@ struct PackedValue;
|
||||
|
||||
class ServerScripting:
|
||||
virtual public ScriptApiBase,
|
||||
public ScriptApiAsync,
|
||||
public ScriptApiDetached,
|
||||
public ScriptApiEntity,
|
||||
public ScriptApiEnv,
|
||||
@@ -41,14 +42,7 @@ public:
|
||||
void saveGlobals();
|
||||
|
||||
// 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);
|
||||
void initAsync() override;
|
||||
|
||||
protected:
|
||||
// from ScriptApiSecurity:
|
||||
@@ -63,6 +57,4 @@ private:
|
||||
void InitializeModApi(lua_State *L, int top);
|
||||
|
||||
static void InitializeAsync(lua_State *L, int top);
|
||||
|
||||
AsyncEngine asyncEngine;
|
||||
};
|
||||
|
Reference in New Issue
Block a user