mirror of
https://github.com/Atmosphere-NX/Atmosphere.git
synced 2025-05-31 06:48:22 -04:00
kern: mostly implement thread exit
This commit is contained in:
parent
c8f71007ec
commit
4a767c9082
8 changed files with 126 additions and 3 deletions
|
@ -147,6 +147,10 @@ namespace ams::kern {
|
|||
return this->is_suspended;
|
||||
}
|
||||
|
||||
bool EnterUserException();
|
||||
bool LeaveUserException();
|
||||
bool ReleaseUserException(KThread *thread);
|
||||
|
||||
KThread *GetPreemptionStatePinnedThread(s32 core_id) const {
|
||||
MESOSPHERE_ASSERT(0 <= core_id && core_id < static_cast<s32>(cpu::NumCores));
|
||||
return this->pinned_threads[core_id];
|
||||
|
@ -186,6 +190,14 @@ namespace ams::kern {
|
|||
void IncrementThreadCount();
|
||||
void DecrementThreadCount();
|
||||
|
||||
void ClearRunningThread(KThread *thread) {
|
||||
for (size_t i = 0; i < util::size(this->running_threads); ++i) {
|
||||
if (this->running_threads[i] == thread) {
|
||||
this->running_threads[i] = nullptr;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
void RegisterThread(KThread *thread);
|
||||
void UnregisterThread(KThread *thread);
|
||||
|
||||
|
|
|
@ -116,6 +116,8 @@ namespace ams::kern {
|
|||
}
|
||||
}
|
||||
|
||||
static NOINLINE void ClearPreviousThread(KThread *thread);
|
||||
|
||||
static NOINLINE void OnThreadStateChanged(KThread *thread, KThread::ThreadState old_state);
|
||||
static NOINLINE void OnThreadPriorityChanged(KThread *thread, s32 old_priority);
|
||||
static NOINLINE void OnThreadAffinityMaskChanged(KThread *thread, const KAffinityMask &old_affinity, s32 old_core);
|
||||
|
|
|
@ -268,6 +268,9 @@ namespace ams::kern {
|
|||
ALWAYS_INLINE void AddWaiterImpl(KThread *thread);
|
||||
ALWAYS_INLINE void RemoveWaiterImpl(KThread *thread);
|
||||
ALWAYS_INLINE static void RestorePriority(KThread *thread);
|
||||
|
||||
void StartTermination();
|
||||
void FinishTermination();
|
||||
public:
|
||||
constexpr u64 GetThreadId() const { return this->thread_id; }
|
||||
|
||||
|
|
|
@ -94,6 +94,10 @@ namespace ams::kern {
|
|||
static KThread &GetMainThread(s32 core_id);
|
||||
static KThread &GetIdleThread(s32 core_id);
|
||||
|
||||
static ALWAYS_INLINE KCurrentContext &GetCurrentContext(s32 core_id) {
|
||||
return GetCoreLocalContext(core_id).current;
|
||||
}
|
||||
|
||||
static ALWAYS_INLINE KScheduler &GetScheduler() {
|
||||
return GetCoreLocalContext().scheduler;
|
||||
}
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue