summaryrefslogtreecommitdiff
path: root/include/kernel/spinlock.h
diff options
context:
space:
mode:
authorRichard Qin <richard.qin.x@gmail.com>2026-07-10 11:31:46 +0800
committerRichard Qin <richard.qin.x@gmail.com>2026-07-10 11:31:46 +0800
commite90b72ec3082588b296956730bd2930cf8d5d671 (patch)
tree36ff6916af9b4176ea5a9662219d11e721f0b691 /include/kernel/spinlock.h
parent1767d390fbf3d0c65389de46caf0b6d43ef3b6ad (diff)
downloadlume-e90b72ec3082588b296956730bd2930cf8d5d671.tar.gz
lume-e90b72ec3082588b296956730bd2930cf8d5d671.tar.xz
refactor: promote new architecture to repository root
Archive the deprecated implementation under lume-legacy, make the new kernel the default root-level build, and update repository entry points without changing kernel behavior.
Diffstat (limited to 'include/kernel/spinlock.h')
-rw-r--r--include/kernel/spinlock.h53
1 files changed, 0 insertions, 53 deletions
diff --git a/include/kernel/spinlock.h b/include/kernel/spinlock.h
deleted file mode 100644
index 1511199..0000000
--- a/include/kernel/spinlock.h
+++ /dev/null
@@ -1,53 +0,0 @@
-// SPDX-License-Identifier: GPL-2.0-or-later
-/*
- * Copyright (C) 2026 Richard QIn
- */
-
-#pragma once
-#include "common/types.h"
-
-struct cpu;
-
-// Spinlock
-// Features: Non-interruptible, busy-wait loop, extremely short hold time.
-// Scenario: Protecting core data such as scheduler, interrupt handling, PMM, etc.
-class Spinlock
-{
-public:
- volatile uint32 locked; // Whether it is locked (0: unlocked, 1: locked)
- const char *name; // Lock Name (for debugging)
- struct cpu *cpu; // The CPU holding the lock
-
- // Constructor
- Spinlock() : locked(0), name("uninit"), cpu(nullptr) {}
-
- // Initialize lock name
- void init(const char *name);
-
- // Acquire lock
- void acquire();
-
- // Release lock
- void release();
-
- // Check if the current CPU holds the lock
- bool holding();
-};
-
-// Mutex
-// Features: Allows interruption, allows sleeping (yield CPU), can hold for a long time.
-// Scenarios: File system IO, device driver waiting, long-term buffering operations.
-class Mutex
-{
-public:
- uint32 locked; // Whether it is locked
- const char *name; // Lock Name
- int pid; // PID of the process holding the lock (for debugging)
-
- Spinlock lk; // Internal spin lock, protects the state of the Mutex itself
-
- void init(const char *name);
- void acquire();
- void release();
- bool holding();
-}; \ No newline at end of file