base: check ownership of thread in cpu_session

Fixes #1431
This commit is contained in:
Alexander Boettcher 2017-06-08 10:54:49 +02:00 committed by Christian Helmuth
parent 0523736ce4
commit 77fe0c882b

View File

@ -117,9 +117,18 @@ void Cpu_session_component::_unsynchronized_kill_thread(Thread_capability thread
void Cpu_session_component::kill_thread(Thread_capability thread_cap)
{
if (!thread_cap.valid())
return;
Lock::Guard lock_guard(_thread_list_lock);
_unsynchronized_kill_thread(thread_cap);
/* check that cap belongs to this session */
for (Cpu_thread_component *t = _thread_list.first(); t; t = t->next()) {
if (t->cap() == thread_cap) {
_unsynchronized_kill_thread(thread_cap);
break;
}
}
}