USB: Don't loop endlessly waiting for a physical buffer.
This is used quite a lot in critical transfer paths, so we don't want to lock things up if no buffers are available for whatever reason. Wait 2 seconds, and if we didn't get anything by then, return B_NO_MEMORY. Possibly fixes or helps with certain USB-related lockups.
This commit is contained in:
@@ -222,7 +222,10 @@ PhysicalMemoryAllocator::Allocate(size_t size, void **logicalAddress,
|
||||
TRACE_ERROR(("PMA: found no free slot to store %ld bytes, waiting\n",
|
||||
size));
|
||||
|
||||
entry.Wait();
|
||||
if (entry.Wait(B_RELATIVE_TIMEOUT, 2 * 1000 * 1000) == B_TIMED_OUT) {
|
||||
TRACE_ERROR(("PMA: timed out waiting for a free slot, giving up\n"));
|
||||
break;
|
||||
}
|
||||
|
||||
if (!_Lock())
|
||||
return B_ERROR;
|
||||
|
||||
Reference in New Issue
Block a user