---
name: "SDL_SemPost"
section: "3"
platform: "linux"
package: "libsdl1.2-dev"
version: "1.2.15+dfsg2-8"
release: "Debian 12 (Bookworm)"
platforms: ["linux"]
url: "https://new.carta.tech/SDL_SemPost"
---

# SDL\_SemPost(3)

Unlock a semaphore.

## NAME

SDL\_SemPost - Unlock a semaphore.

## SYNOPSIS

**#include "SDL.h"** **#include "SDL\_thread.h"**

**int SDL\_SemPost**(**SDL\_sem \*sem**);

## DESCRIPTION

**SDL\_SemPost** unlocks the semaphore pointed to by **sem** and atomically increments the semaphores value. Threads that were blocking on the semaphore may be scheduled after this call succeeds.

**SDL\_SemPost** should be called after a semaphore is locked by a successful call to *SDL\_SemWait*, *SDL\_SemTryWait* or *SDL\_SemWaitTimeout*.

## RETURN VALUE

Returns **0** if successful or **-1** if there was an error (leaving the semaphore unchanged).

## EXAMPLES

```
SDL_SemPost(my_sem);
```

## SEE ALSO

**SDL\_CreateSemaphore**, **SDL\_DestroySemaphore**, **SDL\_SemWait**, **SDL\_SemTryWait**, **SDL\_SemWaitTimeout**, **SDL\_SemValue**
