Skip to content
This repository was archived by the owner on Jan 26, 2024. It is now read-only.

Commit 04cf945

Browse files
committed
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
1 parent a135758 commit 04cf945

File tree

1 file changed

+9
-4
lines changed

1 file changed

+9
-4
lines changed

platform/command.cpp

Lines changed: 9 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -312,7 +312,9 @@ Command::Command(HostQueue& queue, cl_command_type type,
312312
eventWaitList_(eventWaitList),
313313
commandWaitBits_(commandWaitBits) {
314314
// Retain the commands from the event wait list.
315-
std::for_each(eventWaitList.begin(), eventWaitList.end(), std::mem_fun(&Command::retain));
315+
for (const auto &event: eventWaitList) {
316+
event->retain();
317+
}
316318
if (type != 0) activity_.Initialize(type, queue.vdev()->index(), queue.device().index());
317319
}
318320

@@ -321,7 +323,9 @@ void Command::releaseResources() {
321323
const Command::EventWaitList& events = eventWaitList();
322324

323325
// Release the commands from the event wait list.
324-
std::for_each(events.begin(), events.end(), std::mem_fun(&Command::release));
326+
for (const auto &event: events) {
327+
event->release();
328+
}
325329
}
326330

327331
// ================================================================================================
@@ -341,8 +345,9 @@ void Command::enqueue() {
341345

342346
// Notify all commands about the waiter. Barrier will be sent in order to obtain
343347
// HSA signal for a wait on the current queue
344-
std::for_each(eventWaitList().begin(), eventWaitList().end(),
345-
std::bind2nd(std::mem_fun(&Command::notifyCmdQueue), !kCpuWait));
348+
for (const auto &event: eventWaitList()) {
349+
event->notifyCmdQueue(!kCpuWait);
350+
}
346351

347352
// The batch update must be lock protected to avoid a race condition
348353
// when multiple threads submit/flush/update the batch at the same time

0 commit comments

Comments
 (0)