mirror of
https://git.eden-emu.dev/eden-emu/eden
synced 2026-11-08 19:31:16 +01:00
2026-09-20 13:20:40
Signed-off-by: lizzie <lizzie@eden-emu.dev>
This commit is contained in:
parent
2a991fafe9
commit
261cf66e58
1 changed files with 3 additions and 7 deletions
|
|
@ -1236,14 +1236,10 @@ namespace Kernel {
|
||||||
KScopedSchedulerLock sl{kernel};
|
KScopedSchedulerLock sl{kernel};
|
||||||
|
|
||||||
// Determine if this is the first termination request.
|
// Determine if this is the first termination request.
|
||||||
const bool first_request = [&]() -> bool {
|
// Perform an atomic compare-and-swap from false to true.
|
||||||
// Perform an atomic compare-and-swap from false to true.
|
bool expected = false;
|
||||||
bool expected = false;
|
|
||||||
return m_termination_requested.compare_exchange_strong(expected, true);
|
|
||||||
}();
|
|
||||||
|
|
||||||
// If this is the first request, start termination procedure.
|
// If this is the first request, start termination procedure.
|
||||||
if (first_request) {
|
if (m_termination_requested.compare_exchange_strong(expected, true)) {
|
||||||
// If the thread is in initialized state, just change state to terminated.
|
// If the thread is in initialized state, just change state to terminated.
|
||||||
if (this->GetState() == ThreadState::Initialized) {
|
if (this->GetState() == ThreadState::Initialized) {
|
||||||
m_thread_state = ThreadState::Terminated;
|
m_thread_state = ThreadState::Terminated;
|
||||||
|
|
|
||||||
Loading…
Add table
Add a link
Reference in a new issue