kernel/port: Handle mutex_lock returning an error status code.
This can occur if the mutex in question is destroyed while we are waiting for it.
This commit is contained in:
parent
3c47c28a67
commit
057719ef90
@ -633,9 +633,10 @@ get_locked_port(port_id id) GCC_2_NRV(portRef)
|
||||
portRef.SetTo(sPorts.Lookup(id));
|
||||
}
|
||||
|
||||
if (portRef != NULL && portRef->state == Port::kActive)
|
||||
mutex_lock(&portRef->lock);
|
||||
else
|
||||
if (portRef != NULL && portRef->state == Port::kActive) {
|
||||
if (mutex_lock(&portRef->lock) != B_OK)
|
||||
portRef.Unset();
|
||||
} else
|
||||
portRef.Unset();
|
||||
|
||||
return portRef;
|
||||
|
Loading…
x
Reference in New Issue
Block a user