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:
@@ -633,9 +633,10 @@ get_locked_port(port_id id) GCC_2_NRV(portRef)
|
|||||||
portRef.SetTo(sPorts.Lookup(id));
|
portRef.SetTo(sPorts.Lookup(id));
|
||||||
}
|
}
|
||||||
|
|
||||||
if (portRef != NULL && portRef->state == Port::kActive)
|
if (portRef != NULL && portRef->state == Port::kActive) {
|
||||||
mutex_lock(&portRef->lock);
|
if (mutex_lock(&portRef->lock) != B_OK)
|
||||||
else
|
portRef.Unset();
|
||||||
|
} else
|
||||||
portRef.Unset();
|
portRef.Unset();
|
||||||
|
|
||||||
return portRef;
|
return portRef;
|
||||||
|
|||||||
Reference in New Issue
Block a user