---
name: "SDL_IsMainThread"
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_IsMainThread"
---

# SDL\_IsMainThread(3)

Return whether this is the main thread.

## NAME

SDL\_IsMainThread - Return whether this is the main thread.

## HEADER FILE

Defined in SDL3/SDL\_init.h

## SYNOPSIS

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

**bool SDL\_IsMainThread(void);**

## DESCRIPTION

On Apple platforms, the main thread is the thread that runs your program's main() entry point. On other platforms, the main thread is the one that calls  **SDL\_Init** ( **SDL\_INIT\_VIDEO** ), which should usually be the one that runs your program's main() entry point. If you are using the main callbacks,  **SDL\_AppInit** (),

**SDL\_AppIterate** (), and  **SDL\_AppQuit** () are all called on the main thread.

## RETURN VALUE

Returns true if this thread is the main thread, or false otherwise.

## THREAD SAFETY

It is safe to call this function from any thread.

## AVAILABILITY

This function is available since SDL 3.2.0.

## SEE ALSO

**•**(3), [**SDL\_RunOnMainThread**(3)](/SDL_RunOnMainThread/3.md)
