From 24305abae04f08d2cde5efefeb77e84204bde884 Mon Sep 17 00:00:00 2001 From: Matthieu Dorier Date: Fri, 23 Aug 2024 14:31:08 +0100 Subject: [PATCH] allow default-constructed async_response{ --- include/thallium/async_response.hpp | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/include/thallium/async_response.hpp b/include/thallium/async_response.hpp index ffee436..26579ef 100644 --- a/include/thallium/async_response.hpp +++ b/include/thallium/async_response.hpp @@ -30,9 +30,9 @@ class async_response { private: margo_instance_ref m_mid; - margo_request m_request; - hg_handle_t m_handle; - bool m_ignore_response; + margo_request m_request = MARGO_REQUEST_NULL; + hg_handle_t m_handle = HG_HANDLE_NULL; + bool m_ignore_response = false; /** * @brief Constructor. Made private since async_response @@ -53,6 +53,9 @@ class async_response { } public: + + async_response() = default; + /** * @brief Copy constructor is deleted. */ @@ -107,6 +110,8 @@ class async_response { * @return a packed_data containing the response. */ packed_data<> wait() { + if(m_handle == HG_HANDLE_NULL) + throw exception("Calling wait on an invalid async_response"); hg_return_t ret; if(m_request != MARGO_REQUEST_NULL) { ret = margo_wait(m_request);