From cecd78fd61097f7644c8433aadec85d12460fde2 Mon Sep 17 00:00:00 2001 From: Sean Cross Date: Thu, 25 Mar 2021 10:53:32 +0800 Subject: [PATCH] xous: hosted: implement create_thread_n() Signed-off-by: Sean Cross --- xous-rs/src/arch/hosted.rs | 111 +++++++++++++++++++++++++++++++++++++ 1 file changed, 111 insertions(+) diff --git a/xous-rs/src/arch/hosted.rs b/xous-rs/src/arch/hosted.rs index aa172951c..ca1e586a8 100644 --- a/xous-rs/src/arch/hosted.rs +++ b/xous-rs/src/arch/hosted.rs @@ -297,6 +297,117 @@ fn xous_address() -> SocketAddr { .unwrap_or_else(default_xous_address) } +pub fn create_thread_0_pre( + _f: &fn() -> U, +) -> core::result::Result +where + U: Send + 'static, +{ + Ok(ThreadInit {}) +} +pub fn create_thread_1_pre( + _f: &fn(usize) -> U, + _arg1: &usize, +) -> core::result::Result +where + U: Send + 'static, +{ + Ok(ThreadInit {}) +} +pub fn create_thread_2_pre( + _f: &fn(usize, usize) -> U, + _arg1: &usize, + _arg2: &usize, +) -> core::result::Result +where + U: Send + 'static, +{ + Ok(ThreadInit {}) +} +pub fn create_thread_3_pre( + _f: &fn(usize, usize, usize) -> U, + _arg1: &usize, + _arg2: &usize, + _arg3: &usize, +) -> core::result::Result +where + U: Send + 'static, +{ + Ok(ThreadInit {}) +} +pub fn create_thread_4_pre( + _f: &fn(usize, usize, usize, usize) -> U, + _arg1: &usize, + _arg2: &usize, + _arg3: &usize, + _arg4: &usize, +) -> core::result::Result +where + U: Send + 'static, +{ + Ok(ThreadInit {}) +} + +pub fn create_thread_0_post( + f: fn() -> U, + thread_id: TID, +) -> core::result::Result, crate::Error> +where + U: Send + 'static, +{ + create_thread_post(move || f(), thread_id) +} + +pub fn create_thread_1_post( + f: fn(usize) -> U, + arg1: usize, + thread_id: TID, +) -> core::result::Result, crate::Error> +where + U: Send + 'static, +{ + create_thread_post(move || f(arg1), thread_id) +} + +pub fn create_thread_2_post( + f: fn(usize, usize) -> U, + arg1: usize, + arg2: usize, + thread_id: TID, +) -> core::result::Result, crate::Error> +where + U: Send + 'static, +{ + create_thread_post(move || f(arg1, arg2), thread_id) +} + +pub fn create_thread_3_post( + f: fn(usize, usize, usize) -> U, + arg1: usize, + arg2: usize, + arg3: usize, + thread_id: TID, +) -> core::result::Result, crate::Error> +where + U: Send + 'static, +{ + create_thread_post(move || f(arg1, arg2, arg3), thread_id) +} + +pub fn create_thread_4_post( + f: fn(usize, usize, usize, usize) -> U, + arg1: usize, + arg2: usize, + arg3: usize, + arg4: usize, + thread_id: TID, +) -> core::result::Result, crate::Error> +where + U: Send + 'static, +{ + create_thread_post(move || f(arg1, arg2, arg3, arg4), thread_id) +} + pub fn create_thread_simple_pre( _f: &fn(T) -> U, _arg: &T,