Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
Loading...
Searching...
No Matches
pthread_spin.h
Go to the documentation of this file.
1
/*
2
* SPDX-FileCopyrightText: 2014 Freie Universität Berlin
3
* SPDX-License-Identifier: LGPL-2.1-only
4
*/
5
6
#pragma once
7
18
19
#ifdef __cplusplus
20
#include <atomic>
21
using
std::atomic_flag;
22
#else
23
#include <stdatomic.h>
24
#endif
25
32
typedef
struct
{
33
atomic_flag
flag
;
34
}
pthread_spinlock_t
;
35
36
#ifdef __cplusplus
37
extern
"C"
{
38
#endif
39
49
int
pthread_spin_init
(
pthread_spinlock_t
*lock,
int
pshared);
50
60
int
pthread_spin_destroy
(
pthread_spinlock_t
*lock);
61
69
int
pthread_spin_lock
(
pthread_spinlock_t
*lock);
70
79
int
pthread_spin_trylock
(
pthread_spinlock_t
*lock);
80
89
int
pthread_spin_unlock
(
pthread_spinlock_t
*lock);
90
91
#ifdef __cplusplus
92
}
93
#endif
94
pthread_spin_unlock
int pthread_spin_unlock(pthread_spinlock_t *lock)
Releases a spinlock.
pthread_spin_lock
int pthread_spin_lock(pthread_spinlock_t *lock)
Lock a spinlock.
pthread_spin_destroy
int pthread_spin_destroy(pthread_spinlock_t *lock)
Destroys a spinlock.
pthread_spin_init
int pthread_spin_init(pthread_spinlock_t *lock, int pshared)
Initializes a spinlock.
pthread_spin_trylock
int pthread_spin_trylock(pthread_spinlock_t *lock)
Tries to lock a spinlock, returns immediately if already locked.
pthread_spinlock_t
A spinlock.
Definition
pthread_spin.h:32
pthread_spinlock_t::flag
atomic_flag flag
Current lock state.
Definition
pthread_spin.h:33
Generated on Fri Oct 30 2026 12:40:18 by
1.13.2