mirror of
https://github.com/subhobhai943/SUB-OS.git
synced 2026-10-26 00:52:50 +00:00
feat: Massive OS expansion with IPC, Sound & TTS, Block layer, FAT32/ext2/sysfs, Signals, Syscalls, Modules, Drivers & 50+ LazyBox applets
This commit is contained in:
1 parent
5662be29f5
commit
d680335f05
64 files changed
+2370
-166
No files matched your search
@@ -0,0 +1,40 @@
|
||||
#include <kernel/workqueue.h>
|
||||
#include <kernel/printk.h>
|
||||
|
||||
static work_struct_t* work_head = NULL;
|
||||
static work_struct_t* work_tail = NULL;
|
||||
|
||||
void workqueue_init(void) {
|
||||
work_head = NULL;
|
||||
work_tail = NULL;
|
||||
printk(KERN_INFO "WORKQUEUE: Kernel Async Worker Thread Queue online\n");
|
||||
}
|
||||
|
||||
int schedule_work(work_struct_t* work) {
|
||||
if (!work || work->pending) return -1;
|
||||
|
||||
work->pending = true;
|
||||
work->next = NULL;
|
||||
|
||||
if (!work_tail) {
|
||||
work_head = work;
|
||||
work_tail = work;
|
||||
} else {
|
||||
work_tail->next = work;
|
||||
work_tail = work;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
void workqueue_run_pending(void) {
|
||||
while (work_head) {
|
||||
work_struct_t* w = work_head;
|
||||
work_head = w->next;
|
||||
if (!work_head) work_tail = NULL;
|
||||
|
||||
w->pending = false;
|
||||
if (w->func) {
|
||||
w->func(w->data);
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in new issue
Block a user