diff --git a/include/ghex/device/cuda/event.hpp b/include/ghex/device/cuda/event.hpp index 4e0305df..f39c91ca 100644 --- a/include/ghex/device/cuda/event.hpp +++ b/include/ghex/device/cuda/event.hpp @@ -40,15 +40,7 @@ struct cuda_event if (!m_moved) { GHEX_CHECK_CUDA_RESULT_NO_THROW(cudaEventDestroy(m_event)) } } - /** - * @brief Returns `true` if `*this` has been moved, i.e. can no longer be used. - * - * @todo The semantic of this function is a bit confusing as a valid object returns - * `false`. It should be changed such that a valid object returns `true` and an - * invalid one returns `false`. This is the behaviour for `GHEX_C_STRUCT` and - * `GHEX_C_MANAGED_STRUCT` but not for `stream` and `cuda_event`. - */ - operator bool() const noexcept { return m_moved; } + operator bool() const noexcept { return !m_moved; } cudaEvent_t& get() noexcept { diff --git a/include/ghex/device/cuda/event_pool.hpp b/include/ghex/device/cuda/event_pool.hpp index f65a2b67..ce1b77bf 100644 --- a/include/ghex/device/cuda/event_pool.hpp +++ b/include/ghex/device/cuda/event_pool.hpp @@ -70,7 +70,7 @@ struct event_pool while (!(m_next_event < m_events.size())) { m_events.emplace_back(cuda_event()); } const std::size_t event_to_use = m_next_event; - assert(!bool(m_events[event_to_use])); + assert(bool(m_events[event_to_use])); m_next_event += 1; return m_events[event_to_use]; } diff --git a/include/ghex/device/cuda/stream.hpp b/include/ghex/device/cuda/stream.hpp index 0c93ed4b..7ade4771 100644 --- a/include/ghex/device/cuda/stream.hpp +++ b/include/ghex/device/cuda/stream.hpp @@ -39,15 +39,7 @@ struct stream if (!m_moved) { GHEX_CHECK_CUDA_RESULT_NO_THROW(cudaStreamDestroy(m_stream)) } } - /** - * @brief Returns `true` if `*this` has been moved, i.e. can no longer be used. - * - * @todo The semantic of this function is a bit confusing as a valid object returns - * `false`. It should be changed such that a valid object returns `true` and an - * invalid one returns `false`. This is the behaviour for `GHEX_C_STRUCT` and - * `GHEX_C_MANAGED_STRUCT` but not for `stream` and `cuda_event`. - */ - operator bool() const noexcept { return m_moved; } + operator bool() const noexcept { return !m_moved; } operator cudaStream_t() const noexcept {