kernel: Do not attempt to interrupt a thread that is not waiting
This commit is contained in:
parent
2d52abbd5d
commit
135bb9c959
|
@ -383,11 +383,13 @@ thread_unblock_locked(Thread* thread, status_t status)
|
||||||
static inline status_t
|
static inline status_t
|
||||||
thread_interrupt(Thread* thread, bool kill)
|
thread_interrupt(Thread* thread, bool kill)
|
||||||
{
|
{
|
||||||
|
if (thread_is_blocked(thread)) {
|
||||||
if ((thread->wait.flags & B_CAN_INTERRUPT) != 0
|
if ((thread->wait.flags & B_CAN_INTERRUPT) != 0
|
||||||
|| (kill && (thread->wait.flags & B_KILL_CAN_INTERRUPT) != 0)) {
|
|| (kill && (thread->wait.flags & B_KILL_CAN_INTERRUPT) != 0)) {
|
||||||
thread_unblock_locked(thread, B_INTERRUPTED);
|
thread_unblock_locked(thread, B_INTERRUPTED);
|
||||||
return B_OK;
|
return B_OK;
|
||||||
}
|
}
|
||||||
|
}
|
||||||
|
|
||||||
return B_NOT_ALLOWED;
|
return B_NOT_ALLOWED;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue