sdl3-bindgen-sys
Safe HaskellNone
LanguageGHC2021

SDL3.Sys.Bindgen.ThreadShims.FunPtr

Synopsis

Documentation

lithon_SDL_CreateThread :: FunPtr (SDL_ThreadFunction -> PtrConst CChar -> Ptr Void -> IO (Ptr SDL_Thread)) Source #

Create a new thread with a default stack size.

The SDL_CreateThread macro as a function. Like the macro, it calls SDL_CreateThreadRuntime with the C runtime's thread entry and exit functions for the platform it is compiled on (_beginthreadex and _endthreadex on Windows, NULL elsewhere), so prefer it to calling SDL_CreateThreadRuntime directly.

This is equivalent to calling SDL_CreateThreadWithProperties with the following properties set:

  • SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER: fn
  • SDL_PROP_THREAD_CREATE_NAME_STRING: name
  • SDL_PROP_THREAD_CREATE_USERDATA_POINTER: data
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.
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.
Thread safety
It is safe to call this function from any thread.
See also
SDL_CreateThreadWithProperties, SDL_WaitThread
C declaration
lithon_SDL_CreateThread, defined at sdl3-bindgen-sys/SDL_thread_shims.h 54:31

Since: 3.2.0

lithon_SDL_CreateThreadWithProperties :: FunPtr (SDL_PropertiesID -> IO (Ptr SDL_Thread)) Source #

Create a new thread with the specified properties.

The SDL_CreateThreadWithProperties macro as a function, passing the C runtime's thread entry and exit functions like SDL_CreateThread does.

These are the supported properties:

  • SDL_PROP_THREAD_CREATE_ENTRY_FUNCTION_POINTER: an SDL_ThreadFunction value that will be called at the start of the new thread's life. Required.
  • SDL_PROP_THREAD_CREATE_NAME_STRING: the name of the new thread, which might be available to debuggers. Optional, defaults to NULL.
  • SDL_PROP_THREAD_CREATE_USERDATA_POINTER: an arbitrary app-defined pointer, which is passed to the entry function on the new thread, as its only parameter. Optional, defaults to NULL.
  • SDL_PROP_THREAD_CREATE_STACKSIZE_NUMBER: the size, in bytes, of the new thread's stack. Optional, defaults to 0 (system-defined default).
props
the properties to use.
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.
Thread safety
It is safe to call this function from any thread.
See also
SDL_CreateThread, SDL_WaitThread
C declaration
lithon_SDL_CreateThreadWithProperties, defined at sdl3-bindgen-sys/SDL_thread_shims.h 90:31

Since: 3.2.0