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
* 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
20
#ifndef PTHREAD_SPIN_H
21
#define PTHREAD_SPIN_H
22
23
#ifdef __cplusplus
24
#include <atomic>
25
using
std::atomic_flag;
26
#else
27
#include <stdatomic.h>
28
#endif
29
36
typedef
struct
{
37
atomic_flag
flag
;
38
}
pthread_spinlock_t
;
39
40
#ifdef __cplusplus
41
extern
"C"
{
42
#endif
43
53
int
pthread_spin_init
(
pthread_spinlock_t
*lock,
int
pshared);
54
64
int
pthread_spin_destroy
(
pthread_spinlock_t
*lock);
65
73
int
pthread_spin_lock
(
pthread_spinlock_t
*lock);
74
83
int
pthread_spin_trylock
(
pthread_spinlock_t
*lock);
84
93
int
pthread_spin_unlock
(
pthread_spinlock_t
*lock);
94
95
#ifdef __cplusplus
96
}
97
#endif
98
99
#endif
/* PTHREAD_SPIN_H */
100
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:36
pthread_spinlock_t::flag
atomic_flag flag
Current lock state.
Definition
pthread_spin.h:37
Generated on Sat Nov 23 2024 16:31:10 by
1.9.8