Adelsbach Enhanced Threading Library Version 1.0.1

Manual Pages (DD-00013-002)

Enhanced Threading Library > smtx_init (3)
HTML TXT PDF PS
smtx_init(3) Library Functions Manual smtx_init(3)

smtx_initinitialize a spinlock

library “threads”
#include <threadse.h>

int
smtx_init(smtx_t *s, int type);

The function () initializes a spinlock with the given type.

The type argument can be either of

the spinlock is not shared among child processes.
the spinlock is shared among child processes. This is not supported on MacOS.

Upon success smtx_init() returns thrd_success, otherwise thrd_error will be returned.

smtx_destroy(3) smtx_lock(3) smtx_trylock(3) smtx_unlock(3)

The smtx_init() function first appeared in the Adelsbach Enhanced Threading Library. MacOS support was added in version 1.0.1 using an implementation with atomic variables.

Jan Adelsbach <jan@jadelsbach.de>

March 30, 2025 Linux 6.13.6-1-default