Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of framagit.org:simgrid/simgrid
[simgrid.git] / src / smpi / include / smpi_request.hpp
index 091219e..226094d 100644 (file)
@@ -1,4 +1,4 @@
-/* Copyright (c) 2010-2020. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2010-2021. The SimGrid Team. All rights reserved.          */
 
 /* This program is free software; you can redistribute it and/or modify it
  * under the terms of the license (GNU LGPL) which comes with this package. */
@@ -9,18 +9,19 @@
 #include "smpi/smpi.h"
 #include "smpi_f2c.hpp"
 
+#include <memory>
+
 namespace simgrid{
 namespace smpi{
 
-typedef struct s_smpi_mpi_generalized_request_funcs {
+struct smpi_mpi_generalized_request_funcs_t {
   MPI_Grequest_query_function *query_fn;
   MPI_Grequest_free_function *free_fn;
   MPI_Grequest_cancel_function *cancel_fn;
   void* extra_state;
   s4u::ConditionVariablePtr cond;
   s4u::MutexPtr mutex;
-} s_smpi_mpi_generalized_request_funcs_t; 
-typedef struct s_smpi_mpi_generalized_request_funcs *smpi_mpi_generalized_request_funcs;
+};
 
 class Request : public F2C {
   void* buf_;
@@ -47,8 +48,7 @@ class Request : public F2C {
   MPI_Request detached_sender_;
   int refcount_;
   MPI_Op op_;
-  int cancelled_; // tri-state
-  smpi_mpi_generalized_request_funcs generalized_funcs;
+  std::unique_ptr<smpi_mpi_generalized_request_funcs_t> generalized_funcs;
   MPI_Request* nbc_requests_;
   int nbc_requests_size_;
   static bool match_common(MPI_Request req, MPI_Request sender, MPI_Request receiver);
@@ -91,7 +91,7 @@ public:
   static MPI_Request issend(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
   static MPI_Request irecv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm);
 
-  static void recv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status);
+  static int recv(void* buf, int count, MPI_Datatype datatype, int src, int tag, MPI_Comm comm, MPI_Status* status);
   static void bsend(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
   static void send(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);
   static void ssend(const void* buf, int count, MPI_Datatype datatype, int dst, int tag, MPI_Comm comm);