---
name: "SDL_CreateThread"
section: "3"
platform: "linux"
package: "libsdl3-doc"
version: "3.2.10+ds-1"
release: "Debian 13 (Trixie)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_CreateThread"
---

# SDL\_CreateThread(3)

Create a new thread with a default stack size.

## NAME

SDL\_CreateThread - Create a new thread with a default stack size.

## HEADER FILE

Defined in SDL3/SDL\_thread.h

## SYNOPSIS

```
#include "SDL3/SDL.h"
```

**SDL\_Thread \* SDL\_CreateThread(SDL\_ThreadFunction fn, const char \*name, void \*data);**

## DESCRIPTION

This is a convenience function, 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** 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.

## FUNCTION 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

( **SDL\_Thread**\
  \*) 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

**•**(3), [**SDL\_CreateThreadWithProperties**(3)](/SDL_CreateThreadWithProperties/3.md), **•**(3), [**SDL\_WaitThread**(3)](/SDL_WaitThread/3.md)
