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 #include <stdatomic.h>
24 
25 #ifdef __cplusplus
26 extern "C" {
27 #endif
28 
35 typedef struct {
36  atomic_flag flag;
38 
48 int pthread_spin_init(pthread_spinlock_t *lock, int pshared);
49 
60 
69 
79 
89 
90 #ifdef __cplusplus
91 }
92 #endif
93 
94 #endif /* PTHREAD_SPIN_H */
95 
int pthread_spin_trylock(pthread_spinlock_t *lock)
Tries to lock a spinlock, returns immediately if already locked.
int pthread_spin_init(pthread_spinlock_t *lock, int pshared)
Intializes a spinlock.
A spinlock.
Definition: pthread_spin.h:35
int pthread_spin_lock(pthread_spinlock_t *lock)
Lock a spinlock.
int pthread_spin_destroy(pthread_spinlock_t *lock)
Destroys a spinlock.
atomic_flag flag
Current lock state.
Definition: pthread_spin.h:36
int pthread_spin_unlock(pthread_spinlock_t *lock)
Releases a spinlock.