Toggle navigation
Documentation
The friendly Operating System for the Internet of Things
pthread_spin.h
Go to the documentation of this file.
1
/*
2
* Copyright (C) 2014 Freie Universität Berlin
3
*
4
* This file is subject to the terms and conditions of the GNU Lesser
5
* General Public License v2.1. See the file LICENSE in the top level
6
* directory for more details.
7
*/
8
9
#pragma once
10
22
#ifdef __cplusplus
23
#include <atomic>
24
using
std::atomic_flag;
25
#else
26
#include <stdatomic.h>
27
#endif
28
35
typedef
struct
{
36
atomic_flag
flag
;
37
}
pthread_spinlock_t
;
38
39
#ifdef __cplusplus
40
extern
"C"
{
41
#endif
42
52
int
pthread_spin_init
(
pthread_spinlock_t
*lock,
int
pshared);
53
63
int
pthread_spin_destroy
(
pthread_spinlock_t
*lock);
64
72
int
pthread_spin_lock
(
pthread_spinlock_t
*lock);
73
82
int
pthread_spin_trylock
(
pthread_spinlock_t
*lock);
83
92
int
pthread_spin_unlock
(
pthread_spinlock_t
*lock);
93
94
#ifdef __cplusplus
95
}
96
#endif
97
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:35
pthread_spinlock_t::flag
atomic_flag flag
Current lock state.
Definition:
pthread_spin.h:36
Generated on Mon Jun 30 2025 18:46:46 by
1.9.1