SDL_CreateThread

Function SDL_CreateThread 

Source
pub unsafe extern "C" fn SDL_CreateThread(
    fn: SDL_ThreadFunction,
    name: *const c_char,
    data: *mut c_void,
) -> *mut SDL_Thread
Expand description

Create a new thread with a default stack size.

This is a convenience function, equivalent to calling SDL_CreateThreadWithProperties with the following properties set:

Note that this “function” is actually a macro that calls an internal function with two extra parameters not listed here; they are hidden through preprocessor macros and are needed to support various C runtimes at the point of the function call. Language bindings that aren’t using the C headers will need to deal with this.

Usually, apps should just call this function the same way on every platform and let the macros hide the details.

§Parameters

  • fn: the SDL_ThreadFunction function to call in the new thread.
  • name: the name of the thread.
  • data: a pointer that is passed to fn.

§Return value

Returns an opaque pointer to the new thread object on success, NULL if the new thread could not be created; call SDL_GetError() for more information.

§Availability

This function is available since SDL 3.2.0.

§See also