mirror of
https://github.com/justinian/jsix.git
synced 2025-12-10 08:24:32 -08:00
[kernel] Have thread call scheduler on blocking
Instead of making every callsite that may make a thread do a blocking operation also invoke the scheduler, move that logic into thread implementation - if the thread is blocking and is the current thread, call schedule(). Related changes in this commit: - Also make exiting threads and processes call the scheduler when blocking. - Threads start blocked, and get automatically added to the scheduler's blocked list.
This commit is contained in:
@@ -69,7 +69,7 @@ public:
|
||||
/// \returns A pointer to the current thread's TCB
|
||||
inline TCB * current() { return m_current; }
|
||||
|
||||
inline void add_thread(TCB *t) { m_runlists[t->priority].push_back(static_cast<tcb_node*>(t)); }
|
||||
inline void add_thread(TCB *t) { m_blocked.push_back(static_cast<tcb_node*>(t)); }
|
||||
|
||||
/// Get a reference to the system scheduler
|
||||
/// \returns A reference to the global system scheduler
|
||||
|
||||
Reference in New Issue
Block a user