Function nstd_sys::thread::nstd_thread_spawn_with_desc
source · #[no_mangle]
pub unsafe extern "C" fn nstd_thread_spawn_with_desc(
thread_fn: unsafe extern "C" fn(_: NSTDOptionalHeapPtr<'_>) -> NSTDThreadResult,
data: NSTDOptionalHeapPtr<'static>,
desc: &NSTDThreadDescriptor
) -> Option<NSTDThread>Available on crate feature
nstd_thread only.Expand description
Spawns a new thread configured with a descriptor.
Parameters:
-
NSTDThreadResult (*thread_fn)(NSTDOptionalHeapPtr)- The thread function. -
NSTDOptionalHeapPtr data- Data to send to the thread. -
const NSTDThreadDescriptor *desc- The thread descriptor.
Returns
NSTDThread thread - A handle to the new thread, null on error.
Safety
-
The caller of this function must guarantee that
thread_fnis a valid function pointer. -
This operation can cause undefined behavior if
desc’s data is invalid. -
The data type that
dataholds must be able to be safely sent between threads.