mirror of
https://github.com/luanti-org/luanti.git
synced 2025-10-12 08:05:18 +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:
@@ -7210,12 +7210,12 @@ This allows you easy interoperability for delegating work to jobs.
|
||||
* When `func` returns the callback is called (in the normal environment)
|
||||
with all of the return values as arguments.
|
||||
* Optional: Variable number of arguments that are passed to `func`
|
||||
* Returns an `AsyncJob` async job.
|
||||
* `core.register_async_dofile(path)`:
|
||||
* Register a path to a Lua file to be imported when an async environment
|
||||
is initialized. You can use this to preload code which you can then call
|
||||
later using `core.handle_async()`.
|
||||
|
||||
|
||||
### List of APIs available in an async environment
|
||||
|
||||
Classes:
|
||||
@@ -8050,6 +8050,15 @@ use the provided load and write functions for this.
|
||||
* `from_file(filename)`: Experimental. Like `from_string()`, but reads the data
|
||||
from a file.
|
||||
|
||||
`AsyncJob`
|
||||
----------
|
||||
An `AsyncJob` is a reference to a job to be run in an async environment.
|
||||
|
||||
### Methods
|
||||
* `cancel()`: try to cancel the job
|
||||
* Returns whether the job was cancelled.
|
||||
* A job can only be cancelled if it has not started.
|
||||
|
||||
`InvRef`
|
||||
--------
|
||||
|
||||
|
Reference in New Issue
Block a user