Commit b96cba77 authored by Alberto Miranda's avatar Alberto Miranda ♨️
Browse files

Merge branch '147-prepare-0-3-0-release' into 'main'

Resolve "Prepare 0.3.0 release"

Closes #147

See merge request !108
parents d9197476 94b6801b
Loading
Loading
Loading
Loading
Loading
+1 −1
Original line number Diff line number Diff line
# Compilation of scord and execution of tests

image: bscstorage/scord:0.2.0-wip
image: bscstorage/scord:0.3.0

stages:
  - build
+1 −1
Original line number Diff line number Diff line
@@ -30,7 +30,7 @@ cmake_minimum_required(VERSION 3.19)

project(
  scord
  VERSION 0.2.2
  VERSION 0.3.0
  LANGUAGES C CXX
)

docker/0.2.0-wip-debug/Makefile

deleted100644 → 0
+0 −4
Original line number Diff line number Diff line
.PHONY: all

all:
	docker build -t bscstorage/scord:0.2.0-wip-debug .
+0 −85
Original line number Diff line number Diff line
diff --git a/include/thallium/packed_data.hpp b/include/thallium/packed_data.hpp
index 9e6e76e..37e64d3 100644
--- a/include/thallium/packed_data.hpp
+++ b/include/thallium/packed_data.hpp
@@ -14,13 +14,13 @@

 namespace thallium {

-template<typename ... CtxArg> class callable_remote_procedure_with_context;
+template <typename... CtxArg> class callable_remote_procedure_with_context;
 class async_response;
-template<typename ... CtxArg> class request_with_context;
+template <typename... CtxArg> class request_with_context;
 using request = request_with_context<>;

 namespace detail {
-    struct engine_impl;
+struct engine_impl;
 }

 /**
@@ -36,9 +36,9 @@ class packed_data {

   private:
     std::weak_ptr<detail::engine_impl> m_engine_impl;
-    hg_handle_t m_handle = HG_HANDLE_NULL;
-    hg_return_t (*m_unpack_fn)(hg_handle_t,void*) = nullptr;
-    hg_return_t (*m_free_fn)(hg_handle_t,void*) = nullptr;
+    hg_handle_t                        m_handle    = HG_HANDLE_NULL;
+    hg_return_t (*m_unpack_fn)(hg_handle_t, void*) = nullptr;
+    hg_return_t (*m_free_fn)(hg_handle_t, void*)   = nullptr;
     mutable std::tuple<CtxArg...> m_context;

     /**
@@ -62,6 +62,41 @@ class packed_data {
         MARGO_ASSERT(ret, margo_ref_incr);
     }

+    packed_data(const packed_data&)            = delete;
+    packed_data& operator=(const packed_data&) = delete;
+
+    packed_data(packed_data&& rhs)
+    : m_engine_impl(std::move(rhs.m_engine_impl),
+                    m_context(std::move(rhs.m_context))) {
+        m_handle        = rhs.m_handle;
+        rhs.m_handle    = HG_HANDLE_NULL;
+        m_unpack_fn     = rhs.m_unpack_fn;
+        rhs.m_unpack_fn = nullptr;
+        m_free_fn       = rhs.m_free_fn;
+        rhs.m_free_fn   = nullptr;
+    }
+
+    packed_data& operator=(packed_data&& rhs) {
+
+        if(&rhs == this) {
+            return *this;
+        }
+
+        // the original members m_handle, m_context, and m_handle are being
+        // replaced here by the ones from rhs. It may be necessary to release
+        // their resources if `packed_data` has claimed ownership over them,
+        // otherwise we would be leaking
+        m_engine_impl = std::move(rhs.m_engine_impl);
+        m_context = std::move(rhs.m_context);
+
+        m_handle        = rhs.m_handle;
+        rhs.m_handle    = HG_HANDLE_NULL;
+        m_unpack_fn     = rhs.m_unpack_fn;
+        rhs.m_unpack_fn = nullptr;
+        m_free_fn       = rhs.m_free_fn;
+        rhs.m_free_fn   = nullptr;
+    }
+
     packed_data() = default;

   public:
@@ -78,7 +113,7 @@ class packed_data {
      * @tparam NewCtxArg Types of the serialization context.
      * @param args Context.
      */
-    template<typename ... NewCtxArg>
+    template <typename... NewCtxArg>
     auto with_serialization_context(NewCtxArg&&... args) {
         return packed_data<unwrap_decay_t<NewCtxArg>...>(
             m_unpack_fn, m_free_fn, m_handle, m_engine_impl,

docker/0.2.0-wip/Makefile

deleted100644 → 0
+0 −4
Original line number Diff line number Diff line
.PHONY: all

all:
	docker build -t bscstorage/scord:0.2.0-wip .
Loading