From 3f78be3bb89ceefbc1eb68a6c8118df68046b844 Mon Sep 17 00:00:00 2001 From: Tianyu Liu Date: Sat, 25 Jan 2025 23:50:11 -0500 Subject: [PATCH] Cleanup --- cpp/include/kvikio/utils.hpp | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/cpp/include/kvikio/utils.hpp b/cpp/include/kvikio/utils.hpp index ae3e45170d..850d69e197 100644 --- a/cpp/include/kvikio/utils.hpp +++ b/cpp/include/kvikio/utils.hpp @@ -152,18 +152,16 @@ std::tuple get_alloc_info(const void* devPtr, template bool is_future_done(const T& future) { - // If the future does not refer to a valid shared state. if (!future.valid()) { return true; } - // If the future is returned from std::async(std::launch::deferred), its - // state is always deferred until wait() is called. + // If the future is returned from std::async(std::launch::deferred, ...), its state is always + // deferred until wait() is called to make it ready. if (future.wait_for(std::chrono::seconds(0)) == std::future_status::deferred) { future.wait(); return true; } - // If the future is returned from std::async(std::launch:async). - return future.wait_for(std::chrono::seconds(0)) != std::future_status::timeout; + return future.wait_for(std::chrono::seconds(0)) == std::future_status::ready; } #ifdef KVIKIO_CUDA_FOUND