Lazuli
spinlock.h
Go to the documentation of this file.
1 /*
2  * SPDX-License-Identifier: GPL-3.0-only
3  * This file is part of Lazuli.
4  */
5 
14 #ifndef LAZULI_SPINLOCK_H
15 #define LAZULI_SPINLOCK_H
16 
17 #include <stdint.h>
18 
19 #include <Lazuli/common.h>
20 
22 
26 typedef volatile uint8_t Lz_Spinlock;
27 
34 #define LZ_SPINLOCK_INIT ((uint8_t)0)
35 
45 void
46 Lz_Spinlock_Lock(Lz_Spinlock * const spinlock);
47 
57 void
58 Lz_Spinlock_Unlock(Lz_Spinlock * const spinlock);
59 
61 
62 #endif /* LAZULI_SPINLOCK_H */
#define _EXTERN_C_DECL_BEGIN
Open C++ header file declarations.
Definition: common.h:37
volatile uint8_t Lz_Spinlock
Type used to represent a spinlock.
Definition: spinlock.h:26
unsigned char uint8_t
Represents a unsigned integer type with width of exactly 8 bits.
Definition: stdint.h:89
void Lz_Spinlock_Lock(Lz_Spinlock *const spinlock)
Set the lock and enter region, or active wait if the lock is already set.
void Lz_Spinlock_Unlock(Lz_Spinlock *const spinlock)
Unset the lock and leave region.
Definition: spinlock.c:20
Basic type definitions and useful macros.
#define _EXTERN_C_DECL_END
Close C++ header file declarations.
Definition: common.h:42