feat: add threading to Scheduler, fix desktop background selection freeze issue
This commit is contained in:
@@ -98,6 +98,8 @@ namespace Montauk {
|
||||
for (int i = 0; i < Sched::MaxProcesses && count < maxCount; i++) {
|
||||
auto* proc = Sched::GetProcessSlot(i);
|
||||
if (!proc || proc->state == Sched::ProcessState::Free) continue;
|
||||
// Skip sibling-thread slots; only show one entry per process.
|
||||
if (proc->primarySlot != i) continue;
|
||||
|
||||
buf[count].pid = (int32_t)proc->pid;
|
||||
buf[count].parentPid = (int32_t)proc->parentPid;
|
||||
@@ -154,6 +156,25 @@ namespace Montauk {
|
||||
return i;
|
||||
}
|
||||
|
||||
// ====================================================================
|
||||
// Threading
|
||||
// ====================================================================
|
||||
static int Sys_ThreadSpawn(uint64_t entry, uint64_t arg, uint64_t userStackTop) {
|
||||
return Sched::SpawnThread(entry, arg, userStackTop);
|
||||
}
|
||||
|
||||
[[noreturn]] static void Sys_ThreadExit(int exitCode) {
|
||||
Sched::ExitCurrentThread(exitCode);
|
||||
}
|
||||
|
||||
static int Sys_ThreadJoin(int tid, int* outExitCode) {
|
||||
return Sched::JoinThread(tid, outExitCode);
|
||||
}
|
||||
|
||||
static int Sys_ThreadSelf() {
|
||||
return Sched::GetCurrentTid();
|
||||
}
|
||||
|
||||
static int Sys_Chdir(const char* path) {
|
||||
auto* proc = Sched::GetCurrentProcessPtr();
|
||||
if (proc == nullptr || path == nullptr) return -1;
|
||||
|
||||
Reference in New Issue
Block a user