mirror of
https://github.com/lune-org/mlua-luau-scheduler.git
synced 2025-04-10 21:40:55 +01:00
Add missing track method to trait
This commit is contained in:
parent
93a56e28c5
commit
a5ae251fa3
1 changed files with 14 additions and 0 deletions
|
@ -94,6 +94,13 @@ pub trait LuaRuntimeExt<'lua> {
|
||||||
args: impl IntoLuaMulti<'lua>,
|
args: impl IntoLuaMulti<'lua>,
|
||||||
) -> LuaResult<ThreadId>;
|
) -> LuaResult<ThreadId>;
|
||||||
|
|
||||||
|
/**
|
||||||
|
Registers the given thread to be tracked within the current runtime.
|
||||||
|
|
||||||
|
Must be called before waiting for a thread to complete or getting its result.
|
||||||
|
*/
|
||||||
|
fn track_thread(&'lua self, id: ThreadId);
|
||||||
|
|
||||||
/**
|
/**
|
||||||
Gets the result of the given thread.
|
Gets the result of the given thread.
|
||||||
|
|
||||||
|
@ -221,6 +228,13 @@ impl<'lua> LuaRuntimeExt<'lua> for Lua {
|
||||||
queue.push_item(self, thread, args)
|
queue.push_item(self, thread, args)
|
||||||
}
|
}
|
||||||
|
|
||||||
|
fn track_thread(&'lua self, id: ThreadId) {
|
||||||
|
let map = self
|
||||||
|
.app_data_ref::<ThreadResultMap>()
|
||||||
|
.expect("lua threads can only be tracked within a runtime");
|
||||||
|
map.track(id);
|
||||||
|
}
|
||||||
|
|
||||||
fn get_thread_result(&'lua self, id: ThreadId) -> Option<LuaResult<LuaMultiValue<'lua>>> {
|
fn get_thread_result(&'lua self, id: ThreadId) -> Option<LuaResult<LuaMultiValue<'lua>>> {
|
||||||
let map = self
|
let map = self
|
||||||
.app_data_ref::<ThreadResultMap>()
|
.app_data_ref::<ThreadResultMap>()
|
||||||
|
|
Loading…
Add table
Reference in a new issue