2
0

Revert "Avoid lock for last queued command"

This reverts commit 88c3f77bed.

Reason for revert: <INSERT REASONING HERE>

Change-Id: Ie10442c9447f010bb90c679b6cffca5b48b8d054


[ROCm/clr commit: 44bc0cb35d]
Este cometimento está contido em:
German Andryeyev
2020-06-04 15:17:45 -04:00
ascendente 2a42d5838d
cometimento 3d2182f8ba
2 ficheiros modificados com 13 adições e 13 eliminações
+10 -12
Ver ficheiro
@@ -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() {