From d9346129480cb20b5a060f9bfdb03a794a7bdc9d Mon Sep 17 00:00:00 2001 From: Vladislav Sytchenko Date: Wed, 8 Sep 2021 16:18:33 -0400 Subject: [PATCH] SWDEV-1 - Prepare for c++17 switch std::mem_fun() and std::bind2nd() are removed in c++17. Switch to simpler logic that does not require those functions. Change-Id: I19a31f076e1813e367615bd377b424046ce144c7 --- rocclr/platform/command.cpp | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/rocclr/platform/command.cpp b/rocclr/platform/command.cpp index f4567f4179..b8da15fa82 100644 --- a/rocclr/platform/command.cpp +++ b/rocclr/platform/command.cpp @@ -312,7 +312,9 @@ Command::Command(HostQueue& queue, cl_command_type type, eventWaitList_(eventWaitList), commandWaitBits_(commandWaitBits) { // Retain the commands from the event wait list. - std::for_each(eventWaitList.begin(), eventWaitList.end(), std::mem_fun(&Command::retain)); + for (const auto &event: eventWaitList) { + event->retain(); + } if (type != 0) activity_.Initialize(type, queue.vdev()->index(), queue.device().index()); } @@ -321,7 +323,9 @@ void Command::releaseResources() { const Command::EventWaitList& events = eventWaitList(); // Release the commands from the event wait list. - std::for_each(events.begin(), events.end(), std::mem_fun(&Command::release)); + for (const auto &event: events) { + event->release(); + } } // ================================================================================================ @@ -341,8 +345,9 @@ void Command::enqueue() { // Notify all commands about the waiter. Barrier will be sent in order to obtain // HSA signal for a wait on the current queue - std::for_each(eventWaitList().begin(), eventWaitList().end(), - std::bind2nd(std::mem_fun(&Command::notifyCmdQueue), !kCpuWait)); + for (const auto &event: eventWaitList()) { + event->notifyCmdQueue(!kCpuWait); + } // The batch update must be lock protected to avoid a race condition // when multiple threads submit/flush/update the batch at the same time