[Kernel/Thread] Set TLS slot to 0 while freeing

This commit is contained in:
Gliniak 2023-01-28 21:24:32 +01:00 committed by Rick Gibbed
parent e55cb737c1
commit 4e87d1f9d1

View file

@ -138,7 +138,17 @@ void KernelState::set_process_type(uint32_t value) {
uint32_t KernelState::AllocateTLS() { return uint32_t(tls_bitmap_.Acquire()); }
void KernelState::FreeTLS(uint32_t slot) { tls_bitmap_.Release(slot); }
void KernelState::FreeTLS(uint32_t slot) {
const std::vector<object_ref<XThread>> threads =
object_table()->GetObjectsByType<XThread>();
for (const object_ref<XThread>& thread : threads) {
if (thread->is_guest_thread()) {
thread->SetTLSValue(slot, 0);
}
}
tls_bitmap_.Release(slot);
}
void KernelState::RegisterTitleTerminateNotification(uint32_t routine,
uint32_t priority) {