Revert "Avoid lock for last queued command"

This reverts commit dc4e09a63a.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Ie10442c9447f010bb90c679b6cffca5b48b8d054
Este commit está contenido en:
German Andryeyev
2020-06-04 15:17:45 -04:00
padre d8ca3c632c
commit 44bc0cb35d
Se han modificado 2 ficheros con 13 adiciones y 13 borrados
+10 -12
Ver fichero
@@ -192,27 +192,25 @@ bool HostQueue::isEmpty() {
void HostQueue::setLastQueuedCommand(Command* lastCommand) {
// Set last submitted command
Command* lastEnqueueCommand =
lastEnqueueCommand_.exchange(lastCommand, std::memory_order_acq_rel);
if (lastEnqueueCommand != nullptr) {
lastEnqueueCommand->release();
ScopedLock l(lastCmdLock_);
if (lastEnqueueCommand_ != nullptr) {
lastEnqueueCommand_->release();
}
lastEnqueueCommand_ = lastCommand;
if (lastCommand != nullptr) {
lastCommand->retain();
lastEnqueueCommand_->retain();
}
}
Command* HostQueue::getLastQueuedCommand(bool retain) {
// Get last submitted command
Command* lastEnqueueCommand = lastEnqueueCommand_.load(std::memory_order_acquire);
if (lastEnqueueCommand == nullptr) {
return nullptr;
ScopedLock l(lastCmdLock_);
if (retain && lastEnqueueCommand_ != nullptr) {
lastEnqueueCommand_->retain();
}
if (retain) {
lastEnqueueCommand->retain();
}
return lastEnqueueCommand;
return lastEnqueueCommand_;
}
DeviceQueue::~DeviceQueue() {