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:
y5nw
2025-08-26 12:40:31 +02:00
committed by GitHub
parent 7cbe62fe7b
commit f390137d6e
12 changed files with 229 additions and 78 deletions

View File

@@ -0,0 +1,19 @@
// Luanti
// SPDX-License-Identifier: LGPL-2.1-or-later
#pragma once
#include "lua_api/l_base.h"
class ModApiAsync : public ModApiBase
{
public:
static void Initialize(lua_State *L, int top);
private:
// do_async_callback(func, params, mod_origin)
static int l_do_async_callback(lua_State *L);
// cancel_async_callback(id)
static int l_cancel_async_callback(lua_State *L);
// get_async_threading_capacity()
static int l_get_async_threading_capacity(lua_State *L);
};