diff --git a/source/ps/Future.h b/source/ps/Future.h index 410d658b57..a122ed7919 100644 --- a/source/ps/Future.h +++ b/source/ps/Future.h @@ -222,17 +222,6 @@ public: m_SharedState.reset(); } - /** - * Cancels the task (without waiting). - * The result is always invalid, even if the task had completed before. - * Note that this cannot stop started tasks. - */ - void Cancel() - { - if (m_SharedState) - m_SharedState->Cancel(); - m_SharedState.reset(); - } protected: std::shared_ptr m_SharedState; }; diff --git a/source/ps/tests/test_Future.h b/source/ps/tests/test_Future.h index 65fb95614e..2d4216228c 100644 --- a/source/ps/tests/test_Future.h +++ b/source/ps/tests/test_Future.h @@ -95,8 +95,7 @@ public: { Future future; std::function task = future.Wrap([]() { return 1; }); - future.Cancel(); - future.Wait(); + future.CancelOrWait(); TS_ASSERT_THROWS(future.Get(), const Future::BadFutureAccess&); } */ diff --git a/source/simulation2/components/CCmpPathfinder.cpp b/source/simulation2/components/CCmpPathfinder.cpp index 15fdb16464..58e9491b39 100644 --- a/source/simulation2/components/CCmpPathfinder.cpp +++ b/source/simulation2/components/CCmpPathfinder.cpp @@ -1,4 +1,4 @@ -/* Copyright (C) 2021 Wildfire Games. +/* Copyright (C) 2022 Wildfire Games. * This file is part of 0 A.D. * * 0 A.D. is free software: you can redistribute it and/or modify @@ -107,7 +107,7 @@ void CCmpPathfinder::Deinit() // Wait on all pathfinding tasks. for (Future& future : m_Futures) - future.Cancel(); + future.CancelOrWait(); m_Futures.clear(); SAFE_DELETE(m_AtlasOverlay);