Voxia OS
v0.0.1
Hobby Project Operating System Targeting x86-64
Loading...
Searching...
No Matches
spinlock.h
Go to the documentation of this file.
1
#ifndef __SPINLOCK_H__
2
#define __SPINLOCK_H__
3
4
#include <
type.h
>
5
6
#ifdef __cplusplus
7
extern
"C"
{
8
#endif
9
10
typedef
struct
{
11
uint16_t
now_serving
;
/* tiket yang sedang dilayani */
12
uint16_t
next_ticket
;
/* counter untuk waiter baru */
13
}
spinlock_t
;
14
15
#define SPINLOCK_INIT \
16
{ .now_serving = 0, .next_ticket = 0 }
17
18
void
spin_acquire
(
spinlock_t
*
lock
);
19
void
spin_release
(
spinlock_t
*
lock
);
20
bool
spin_is_locked
(
const
spinlock_t
*
lock
);
21
22
#ifdef __cplusplus
23
}
24
#endif
25
26
#endif
// __SPINLOCK_H__
lock
uint8_t lock
Definition
cache.h:1
spin_acquire
void spin_acquire(spinlock_t *lock)
Definition
spinlock.c:8
spin_is_locked
bool spin_is_locked(const spinlock_t *lock)
Definition
spinlock.c:27
spin_release
void spin_release(spinlock_t *lock)
Definition
spinlock.c:19
spinlock_t
Definition
spinlock.h:10
spinlock_t::now_serving
uint16_t now_serving
Definition
spinlock.h:11
spinlock_t::next_ticket
uint16_t next_ticket
Definition
spinlock.h:12
type.h
uint16_t
unsigned short uint16_t
Definition
type.h:13
include
spinlock.h
Generated on Sat May 30 2026 11:09:57 for Voxia OS by
1.13.2