Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
finish removing simix.h from C files, and avoid the use of Ptr when not needed
authorMartin Quinson <martin.quinson@loria.fr>
Mon, 3 Jul 2017 23:58:04 +0000 (01:58 +0200)
committerMartin Quinson <martin.quinson@loria.fr>
Tue, 4 Jul 2017 00:14:07 +0000 (02:14 +0200)
21 files changed:
examples/msg/actions-comm/actions-comm.c
include/simgrid/forward.h
include/simgrid/msg.h
include/simgrid/s4u/Comm.hpp
include/simgrid/simix.h
src/include/mc/mc.h
src/kernel/activity/CommImpl.hpp
src/msg/msg_gos.cpp
src/simix/libsmx.cpp
src/simix/popping_private.h
src/simix/smx_network.cpp
src/simix/smx_network_private.h
src/smpi/smpi_request.cpp
src/smpi/smpi_request.hpp
src/xbt/xbt_os_synchro.cpp [moved from src/xbt/xbt_os_synchro.c with 65% similarity]
teshsuite/simix/CMakeLists.txt
teshsuite/simix/check_defaults/check_defaults.cpp [moved from teshsuite/simix/check_defaults/check_defaults.c with 94% similarity]
teshsuite/simix/stack_overflow/stack_overflow.cpp [moved from teshsuite/simix/stack_overflow/stack_overflow.c with 94% similarity]
teshsuite/xbt/parmap_bench/parmap_bench.c
teshsuite/xbt/parmap_test/parmap_test.c
tools/cmake/DefinePackages.cmake

index 20b4990..2c487db 100644 (file)
@@ -1,10 +1,9 @@
-/* Copyright (c) 2009-2016. The SimGrid Team. All rights reserved.          */
+/* Copyright (c) 2009-2017. 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. */
 
-#include "simgrid/msg.h"
-#include "simgrid/simix.h"      /* semaphores for the barrier */
+#include <simgrid/msg.h>
 #include <xbt/replay.hpp>
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(actions, "Messages specific for this msg example");
index 3776800..8545b57 100644 (file)
@@ -1,11 +1,10 @@
-/* Copyright (c) 2004-2015. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2004-2017. 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. */
 
-#ifndef SG_PLATF_TYPES_H
-#define SG_PLATF_TYPES_H
+#ifndef SIMGRID_TYPES_H
+#define SIMGRID_TYPES_H
 
 #ifdef __cplusplus
 
 
 namespace simgrid {
 namespace kernel {
+namespace context {
+class Context;
+class ContextFactory;
+}
 namespace activity {
   class ActivityImpl;
   using ActivityImplPtr = boost::intrusive_ptr<ActivityImpl>;
@@ -31,7 +34,10 @@ namespace activity {
   using RawImplPtr = boost::intrusive_ptr<RawImpl>;
   class SleepImpl;
   using SleepImplPtr = boost::intrusive_ptr<SleepImpl>;
+
+  class MailboxImpl;
 }
+
 namespace routing {
   class NetPoint;
 }
@@ -40,6 +46,8 @@ namespace simix {
   class ActorImpl;
   using ActorImplPtr = boost::intrusive_ptr<ActorImpl>;
   class Host;
+
+  class MutexImpl;
 }
 namespace surf {
   class Resource;
@@ -66,6 +74,11 @@ typedef simgrid::kernel::routing::NetPoint routing_NetPoint;
 typedef simgrid::surf::Resource surf_Resource;
 typedef simgrid::trace_mgr::trace tmgr_Trace;
 
+typedef simgrid::kernel::context::Context* smx_context_t;
+typedef simgrid::simix::ActorImpl* smx_actor_t;
+typedef simgrid::simix::MutexImpl* smx_mutex_t;
+typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
+
 #else
 
 typedef struct s4u_Actor s4u_Actor;
@@ -79,6 +92,11 @@ typedef struct routing_NetPoint routing_NetPoint;
 typedef struct surf_Resource surf_Resource;
 typedef struct Trace tmgr_Trace;
 
+typedef struct s_smx_context* smx_context_t;
+typedef struct s_smx_actor* smx_actor_t;
+typedef struct s_smx_mutex* smx_mutex_t;
+typedef struct s_smx_mailbox* smx_mailbox_t;
+
 #endif
 
 typedef s4u_NetZone* sg_netzone_t;
@@ -127,4 +145,4 @@ typedef long long sg_offset_t;
 
 typedef unsigned long aid_t;
 
-#endif
+#endif /* SIMGRID_TYPES_H */
index 057b20c..00ea2fb 100644 (file)
@@ -7,10 +7,16 @@
 #ifndef MSG_H
 #define MSG_H
 
+#include "simgrid/datatypes.h"
 #include "simgrid/forward.h"
-#include "simgrid/simix.h"
+#include "simgrid/host.h"
+
+#include "xbt/base.h"
+#include "xbt/dict.h"
+#include "xbt/dynar.h"
 
 #ifdef __cplusplus
+#include "simgrid/simix.h"
 namespace simgrid {
 namespace msg {
 class Comm;
@@ -386,8 +392,9 @@ XBT_PUBLIC(msg_error_t) MSG_task_receive_bounded(msg_task_t * task, const char *
 
 XBT_PUBLIC(msg_comm_t) MSG_task_isend(msg_task_t task, const char *alias);
 XBT_PUBLIC(msg_comm_t) MSG_task_isend_bounded(msg_task_t task, const char *alias, double maxrate);
-XBT_PUBLIC(msg_comm_t) MSG_task_isend_with_matching(msg_task_t task, const char *alias,
-    int (*match_fun)(void*,void*, smx_activity_t), void *match_data);
+XBT_PUBLIC(msg_comm_t)
+MSG_task_isend_with_matching(msg_task_t task, const char* alias, int (*match_fun)(void*, void*, void*),
+                             void* match_data);
 
 XBT_PUBLIC(void) MSG_task_dsend(msg_task_t task, const char *alias, void_f_pvoid_t cleanup);
 XBT_PUBLIC(void) MSG_task_dsend_bounded(msg_task_t task, const char *alias, void_f_pvoid_t cleanup, double maxrate);
index 4adecc0..d409c0b 100644 (file)
@@ -104,7 +104,7 @@ private:
 
   /* FIXME: expose these elements in the API */
   int detached_ = 0;
-  int (*matchFunction_)(void*, void*, smx_activity_t) = nullptr;
+  int (*matchFunction_)(void*, void*, simgrid::kernel::activity::CommImpl*) = nullptr;
   void (*cleanFunction_)(void*) = nullptr;
   void (*copyDataFunction_)(smx_activity_t, void*, size_t) = nullptr;
 
index 152fccc..45d1ab2 100644 (file)
 #include "xbt/ex.h"
 #include "xbt/parmap.h"
 
-#ifdef __cplusplus
-
-namespace simgrid {
-namespace kernel {
-namespace context {
-  class Context;
-  class ContextFactory;
-  }
-  namespace activity {
-  class MailboxImpl;
-  }
-  }
-
-  namespace simix {
-
-  class MutexImpl;
-}
-}
-
-typedef simgrid::kernel::context::Context* smx_context_t;
-typedef simgrid::simix::ActorImpl* smx_actor_t;
-typedef simgrid::simix::MutexImpl* smx_mutex_t;
-typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
-
-#else
-
-typedef struct s_smx_context *smx_context_t;
-typedef struct s_smx_actor   *smx_actor_t;
-typedef struct s_smx_mutex   *smx_mutex_t;
-typedef struct s_smx_mailbox *smx_mailbox_t;
-
-#endif
 
 /* ******************************** Host ************************************ */
 /** @brief Host datatype
@@ -269,36 +237,30 @@ SG_END_DECL()
 
 /************************** Comunication simcalls *****************************/
 
-XBT_PUBLIC(void) simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size,
-                                     double rate, void *src_buff,
-                                     size_t src_buff_size,
-                                     int (*match_fun)(void *, void *, smx_activity_t),
-                                     void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                                     void *data, double timeout);
-
-XBT_PUBLIC(smx_activity_t) simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox,
-                                              double task_size,
-                                              double rate, void *src_buff,
-                                              size_t src_buff_size,
-                                              int (*match_fun)(void *, void *, smx_activity_t),
-                                              void (*clean_fun)(void *),
-                                              void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                                              void *data, int detached);
-
-XBT_PUBLIC(void) simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff,
-                                   size_t * dst_buff_size,
-                                   int (*match_fun)(void *, void *, smx_activity_t),
-                                   void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                                   void *data, double timeout, double rate);
-
-XBT_PUBLIC(smx_activity_t) simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff,
-                                            size_t * dst_buff_size,
-                                            int (*match_fun)(void *, void *, smx_activity_t),
-                                            void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                                            void *data, double rate);
-
-XBT_PUBLIC(smx_activity_t) simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag,
-                                int (*match_fun)(void *, void *, smx_activity_t), void *data);
+XBT_PUBLIC(void)
+simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
+                  size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                  void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout);
+
+XBT_PUBLIC(smx_activity_t)
+simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
+                   size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                   void (*clean_fun)(void*), void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+                   int detached);
+
+XBT_PUBLIC(void)
+simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+                  int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                  void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout, double rate);
+
+XBT_PUBLIC(smx_activity_t)
+simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+                   int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                   void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double rate);
+
+XBT_PUBLIC(smx_activity_t)
+simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag,
+                    int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* data);
 XBT_PUBLIC(void) simcall_comm_cancel(smx_activity_t comm);
 
 /* FIXME: waitany is going to be a vararg function, and should take a timeout */
index 0834db9..23f056f 100644 (file)
@@ -6,8 +6,8 @@
 #ifndef MC_MC_H
 #define MC_MC_H
 
+#include <simgrid/forward.h>
 #include <simgrid/modelchecker.h> /* our public interface (and definition of SIMGRID_HAVE_MC) */
-#include <simgrid/simix.h>
 
 /* Maximum size of the application heap.
  *
index bbf350c..fb60e05 100644 (file)
@@ -39,9 +39,10 @@ public:
   bool detached = false; /* If detached or not */
 
   void (*clean_fun)(void*) = nullptr; /* Function to clean the detached src_buf if something goes wrong */
-  int (*match_fun)(void*, void*, smx_activity_t) = nullptr; /* Filter function used by the other side. It is used when
-                                      looking if a given communication matches my needs. For that, myself must match the
-                                      expectations of the other side, too. See  */
+  int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*) =
+      nullptr; /* Filter function used by the other side. It is used when
+looking if a given communication matches my needs. For that, myself must match the
+expectations of the other side, too. See  */
   void (*copy_data_fun)(smx_activity_t, void*, size_t) = nullptr;
 
   /* Surf action data */
index d0127d7..bb023aa 100644 (file)
@@ -297,9 +297,9 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d
 }
 
 /* Internal function used to factorize code between MSG_task_isend_with_matching() and MSG_task_dsend(). */
-static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *alias,
-                                                     int (*match_fun)(void*,void*, smx_activity_t),
-                                                     void *match_data, void_f_pvoid_t cleanup, int detached)
+static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const charalias,
+                                                 int (*match_fun)(void*, void*, void*), void* match_data,
+                                                 void_f_pvoid_t cleanup, int detached)
 {
   simdata_task_t t_simdata = nullptr;
   msg_process_t myself = MSG_process_self();
@@ -315,8 +315,9 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *al
   msg_global->sent_msg++;
 
   /* Send it by calling SIMIX network layer */
-  smx_activity_t act = simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate,
-                                         task, sizeof(void *), match_fun, cleanup, nullptr, match_data,detached);
+  smx_activity_t act =
+      simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, task,
+                         sizeof(void*), (simix_match_func_t)match_fun, cleanup, nullptr, match_data, detached);
   t_simdata->comm = boost::static_pointer_cast<simgrid::kernel::activity::CommImpl>(act);
 
   msg_comm_t comm = nullptr;
@@ -377,8 +378,8 @@ msg_comm_t MSG_task_isend_bounded(msg_task_t task, const char *alias, double max
  * \param match_data user provided data passed to match_fun
  * \return the msg_comm_t communication created
  */
-msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char *alias,
-                                        int (*match_fun)(void*, void*, smx_activity_t), void *match_data)
+msg_comm_t MSG_task_isend_with_matching(msg_task_t task, const char* alias, int (*match_fun)(void*, void*, void*),
+                                        void* match_data)
 {
   return MSG_task_isend_internal(task, alias, match_fun, match_data, nullptr, 0);
 }
index 96cd223..cbb5bbb 100644 (file)
@@ -355,11 +355,9 @@ e_smx_state_t simcall_process_sleep(double duration)
 /**
  * \ingroup simix_comm_management
  */
-void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
-                         void *src_buff, size_t src_buff_size,
-                         int (*match_fun)(void *, void *, smx_activity_t),
-                         void (*copy_data_fun)(smx_activity_t, void*, size_t), void *data,
-                         double timeout)
+void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
+                       size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                       void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout)
 {
   /* checking for infinite values */
   xbt_assert(std::isfinite(task_size), "task_size is not finite!");
@@ -385,13 +383,11 @@ void simcall_comm_send(smx_actor_t sender, smx_mailbox_t mbox, double task_size,
 /**
  * \ingroup simix_comm_management
  */
-smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate,
-                              void *src_buff, size_t src_buff_size,
-                              int (*match_fun)(void *, void *, smx_activity_t),
-                              void (*clean_fun)(void *),
-                              void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                              void *data,
-                              int detached)
+smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
+                                  size_t src_buff_size,
+                                  int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                  void (*clean_fun)(void*), void (*copy_data_fun)(smx_activity_t, void*, size_t),
+                                  void* data, int detached)
 {
   /* checking for infinite values */
   xbt_assert(std::isfinite(task_size), "task_size is not finite!");
@@ -407,10 +403,9 @@ smx_activity_t simcall_comm_isend(smx_actor_t sender, smx_mailbox_t mbox, double
 /**
  * \ingroup simix_comm_management
  */
-void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t * dst_buff_size,
-                       int (*match_fun)(void *, void *, smx_activity_t),
-                       void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                       void *data, double timeout, double rate)
+void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+                       int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                       void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double timeout, double rate)
 {
   xbt_assert(std::isfinite(timeout), "timeout is not finite!");
   xbt_assert(mbox, "No rendez-vous point defined for recv");
@@ -431,10 +426,9 @@ void simcall_comm_recv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff,
 /**
  * \ingroup simix_comm_management
  */
-smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size,
-                                int (*match_fun)(void *, void *, smx_activity_t),
-                                void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                                void *data, double rate)
+smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+                                  int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                  void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data, double rate)
 {
   xbt_assert(mbox, "No rendez-vous point defined for irecv");
 
@@ -446,7 +440,7 @@ smx_activity_t simcall_comm_irecv(smx_actor_t receiver, smx_mailbox_t mbox, void
  * \ingroup simix_comm_management
  */
 smx_activity_t simcall_comm_iprobe(smx_mailbox_t mbox, int type, int src, int tag,
-                                int (*match_fun)(void *, void *, smx_activity_t), void *data)
+                                   int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* data)
 {
   xbt_assert(mbox, "No rendez-vous point defined for iprobe");
 
index 698a3a5..160e55e 100644 (file)
@@ -22,7 +22,7 @@ XBT_PUBLIC_DATA(const char*) simcall_names[]; /* Name of each simcall */
 
 #include "popping_enum.h" /* Definition of e_smx_simcall_t, with one value per simcall */
 
-typedef int (*simix_match_func_t)(void *, void *, smx_activity_t);
+typedef int (*simix_match_func_t)(void*, void*, simgrid::kernel::activity::CommImpl*);
 typedef void (*simix_copy_data_func_t)(smx_activity_t, void*, size_t);
 typedef void (*simix_clean_func_t)(void *);
 typedef void (*FPtr)(void); // Hide the ugliness
index d4a4781..2dcabbc 100644 (file)
@@ -35,8 +35,8 @@ static void SIMIX_comm_start(simgrid::kernel::activity::CommImplPtr synchro);
  */
 static simgrid::kernel::activity::CommImplPtr
 _find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* deque, e_smx_comm_type_t type,
-                    int (*match_fun)(void*, void*, smx_activity_t), void* this_user_data, smx_activity_t my_synchro,
-                    bool remove_matching)
+                    int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*), void* this_user_data,
+                    simgrid::kernel::activity::CommImplPtr my_synchro, bool remove_matching)
 {
   void* other_user_data = nullptr;
 
@@ -49,8 +49,8 @@ _find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* dequ
     } else if (comm->type == SIMIX_COMM_RECEIVE) {
       other_user_data = comm->dst_data;
     }
-    if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, comm)) &&
-        (not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro))) {
+    if (comm->type == type && (match_fun == nullptr || match_fun(this_user_data, other_user_data, comm.get())) &&
+        (not comm->match_fun || comm->match_fun(other_user_data, this_user_data, my_synchro.get()))) {
       XBT_DEBUG("Found a matching communication synchro %p", comm.get());
       if (remove_matching)
         deque->erase(it);
@@ -71,25 +71,24 @@ _find_matching_comm(boost::circular_buffer_space_optimized<smx_activity_t>* dequ
 /******************************************************************************/
 /*                          Communication synchros                            */
 /******************************************************************************/
-XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t src, smx_mailbox_t mbox,
-                                  double task_size, double rate,
-                                  void *src_buff, size_t src_buff_size,
-                                  int (*match_fun)(void *, void *,smx_activity_t),
-                                  void (*copy_data_fun)(smx_activity_t, void*, size_t),
-          void *data, double timeout){
+XBT_PRIVATE void simcall_HANDLER_comm_send(smx_simcall_t simcall, smx_actor_t src, smx_mailbox_t mbox, double task_size,
+                                           double rate, void* src_buff, size_t src_buff_size,
+                                           int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                           void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+                                           double timeout)
+{
   smx_activity_t comm = simcall_HANDLER_comm_isend(simcall, src, mbox, task_size, rate,
                            src_buff, src_buff_size, match_fun, nullptr, copy_data_fun,
                data, 0);
   SIMCALL_SET_MC_VALUE(simcall, 0);
   simcall_HANDLER_comm_wait(simcall, comm, timeout);
 }
-XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx_actor_t src_proc, smx_mailbox_t mbox,
-                                  double task_size, double rate,
-                                  void *src_buff, size_t src_buff_size,
-                                  int (*match_fun)(void *, void *,smx_activity_t),
-                                  void (*clean_fun)(void *), // used to free the synchro in case of problem after a detached send
-                                  void (*copy_data_fun)(smx_activity_t, void*, size_t),// used to copy data if not default one
-                          void *data, int detached)
+XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(
+    smx_simcall_t simcall, smx_actor_t src_proc, smx_mailbox_t mbox, double task_size, double rate, void* src_buff,
+    size_t src_buff_size, int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+    void (*clean_fun)(void*), // used to free the synchro in case of problem after a detached send
+    void (*copy_data_fun)(smx_activity_t, void*, size_t), // used to copy data if not default one
+    void* data, int detached)
 {
   XBT_DEBUG("send from mailbox %p", mbox);
 
@@ -154,10 +153,10 @@ XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_isend(smx_simcall_t simcall, smx
 }
 
 XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox,
-                         void *dst_buff, size_t *dst_buff_size,
-                         int (*match_fun)(void *, void *, smx_activity_t),
-                         void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                         void *data, double timeout, double rate)
+                                           void* dst_buff, size_t* dst_buff_size,
+                                           int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                           void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+                                           double timeout, double rate)
 {
   smx_activity_t comm = SIMIX_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
   SIMCALL_SET_MC_VALUE(simcall, 0);
@@ -165,18 +164,19 @@ XBT_PRIVATE void simcall_HANDLER_comm_recv(smx_simcall_t simcall, smx_actor_t re
 }
 
 XBT_PRIVATE smx_activity_t simcall_HANDLER_comm_irecv(smx_simcall_t simcall, smx_actor_t receiver, smx_mailbox_t mbox,
-    void *dst_buff, size_t *dst_buff_size,
-    int (*match_fun)(void *, void *, smx_activity_t),
-    void (*copy_data_fun)(smx_activity_t, void*, size_t),
-    void *data, double rate)
+                                                      void* dst_buff, size_t* dst_buff_size,
+                                                      simix_match_func_t match_fun,
+                                                      void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+                                                      double rate)
 {
   return SIMIX_comm_irecv(receiver, mbox, dst_buff, dst_buff_size, match_fun, copy_data_fun, data, rate);
 }
 
-smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void *dst_buff, size_t *dst_buff_size,
-    int (*match_fun)(void *, void *, smx_activity_t),
-    void (*copy_data_fun)(smx_activity_t, void*, size_t), // used to copy data if not default one
-    void *data, double rate)
+smx_activity_t
+SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff, size_t* dst_buff_size,
+                 int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                 void (*copy_data_fun)(smx_activity_t, void*, size_t), // used to copy data if not default one
+                 void* data, double rate)
 {
   simgrid::kernel::activity::CommImplPtr this_synchro =
       simgrid::kernel::activity::CommImplPtr(new simgrid::kernel::activity::CommImpl(SIMIX_COMM_RECEIVE));
@@ -247,15 +247,14 @@ smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void *
   return other_comm;
 }
 
-smx_activity_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox,
-                                   int type, int src, int tag,
-                                   int (*match_fun)(void *, void *, smx_activity_t),
-                                   void *data){
+smx_activity_t simcall_HANDLER_comm_iprobe(smx_simcall_t simcall, smx_mailbox_t mbox, int type, int src, int tag,
+                                           simix_match_func_t match_fun, void* data)
+{
   return SIMIX_comm_iprobe(simcall->issuer, mbox, type, src, tag, match_fun, data);
 }
 
-smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src,
-                              int tag, int (*match_fun)(void *, void *, smx_activity_t), void *data)
+smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag,
+                                 simix_match_func_t match_fun, void* data)
 {
   XBT_DEBUG("iprobe from %p %p", mbox, &mbox->comm_queue);
   simgrid::kernel::activity::CommImplPtr this_comm;
index c3a0c34..80924c3 100644 (file)
 #include "src/kernel/activity/MailboxImpl.hpp"
 #include "src/simix/ActorImpl.hpp"
 
-XBT_PRIVATE smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox,
-                              void *dst_buff, size_t *dst_buff_size,
-                              int (*match_fun)(void *, void *, smx_activity_t),
-                              void (*copy_data_fun)(smx_activity_t, void*, size_t),
-                              void *data, double rate);
-XBT_PRIVATE smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src,
-                              int tag, int (*match_fun)(void *, void *, smx_activity_t), void *data);
+XBT_PRIVATE smx_activity_t SIMIX_comm_irecv(smx_actor_t dst_proc, smx_mailbox_t mbox, void* dst_buff,
+                                            size_t* dst_buff_size,
+                                            int (*match_fun)(void*, void*, simgrid::kernel::activity::CommImpl*),
+                                            void (*copy_data_fun)(smx_activity_t, void*, size_t), void* data,
+                                            double rate);
+XBT_PRIVATE smx_activity_t SIMIX_comm_iprobe(smx_actor_t dst_proc, smx_mailbox_t mbox, int type, int src, int tag,
+                                             simix_match_func_t match_fun, void* data);
 
 #endif
index 3547243..7080784 100644 (file)
@@ -117,7 +117,8 @@ void Request::unref(MPI_Request* request)
   }
 }
 
-int Request::match_recv(void* a, void* b, smx_activity_t ignored) {
+int Request::match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored)
+{
   MPI_Request ref = static_cast<MPI_Request>(a);
   MPI_Request req = static_cast<MPI_Request>(b);
   XBT_DEBUG("Trying to match a recv of src %d against %d, tag %d against %d",ref->src_,req->src_, ref->tag_, req->tag_);
@@ -140,7 +141,8 @@ int Request::match_recv(void* a, void* b, smx_activity_t ignored) {
   }else return 0;
 }
 
-int Request::match_send(void* a, void* b,smx_activity_t ignored) {
+int Request::match_send(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored)
+{
   MPI_Request ref = static_cast<MPI_Request>(a);
   MPI_Request req = static_cast<MPI_Request>(b);
   XBT_DEBUG("Trying to match a send of src %d against %d, tag %d against %d",ref->src_,req->src_, ref->tag_, req->tag_);
index 96d1cf8..535ebab 100644 (file)
@@ -88,8 +88,8 @@ class Request : public F2C {
     static int waitall(int count, MPI_Request requests[], MPI_Status status[]);
     static int waitsome(int incount, MPI_Request requests[], int *indices, MPI_Status status[]);
 
-    static int match_send(void* a, void* b,smx_activity_t ignored);
-    static int match_recv(void* a, void* b,smx_activity_t ignored);
+    static int match_send(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored);
+    static int match_recv(void* a, void* b, simgrid::kernel::activity::CommImpl* ignored);
 
     int add_f();
     static void free_f(int id);
similarity index 65%
rename from src/xbt/xbt_os_synchro.c
rename to src/xbt/xbt_os_synchro.cpp
index 1a7adda..748faa2 100644 (file)
@@ -9,63 +9,63 @@
 #include "xbt/ex.h"
 #include "xbt/synchro.h"
 
-#include "simgrid/simix.h"        /* used implementation */
+#include "simgrid/simix.h" /* used implementation */
 
 XBT_LOG_NEW_DEFAULT_SUBCATEGORY(xbt_sync, xbt, "Synchronization mechanism");
 
 /****** mutex related functions ******/
 xbt_mutex_t xbt_mutex_init(void)
 {
-  return (xbt_mutex_t) simcall_mutex_init();
+  return (xbt_mutex_t)simcall_mutex_init();
 }
 
 void xbt_mutex_acquire(xbt_mutex_t mutex)
 {
-  simcall_mutex_lock((smx_mutex_t) mutex);
+  simcall_mutex_lock((smx_mutex_t)mutex);
 }
 
 int xbt_mutex_try_acquire(xbt_mutex_t mutex)
 {
-  return simcall_mutex_trylock((smx_mutex_t) mutex);
+  return simcall_mutex_trylock((smx_mutex_t)mutex);
 }
 
 void xbt_mutex_release(xbt_mutex_t mutex)
 {
-  simcall_mutex_unlock((smx_mutex_t) mutex);
+  simcall_mutex_unlock((smx_mutex_t)mutex);
 }
 
 void xbt_mutex_destroy(xbt_mutex_t mutex)
 {
-  SIMIX_mutex_unref((smx_mutex_t) mutex);
+  SIMIX_mutex_unref((smx_mutex_t)mutex);
 }
 
 /***** condition related functions *****/
 xbt_cond_t xbt_cond_init(void)
 {
-  return (xbt_cond_t) simcall_cond_init();
+  return (xbt_cond_t)simcall_cond_init();
 }
 
 void xbt_cond_wait(xbt_cond_t cond, xbt_mutex_t mutex)
 {
-  simcall_cond_wait((smx_cond_t) cond, (smx_mutex_t) mutex);
+  simcall_cond_wait((smx_cond_t)cond, (smx_mutex_t)mutex);
 }
 
 void xbt_cond_timedwait(xbt_cond_t cond, xbt_mutex_t mutex, double delay)
 {
-  simcall_cond_wait_timeout((smx_cond_t) cond, (smx_mutex_t) mutex, delay);
+  simcall_cond_wait_timeout((smx_cond_t)cond, (smx_mutex_t)mutex, delay);
 }
 
 void xbt_cond_signal(xbt_cond_t cond)
 {
-  simcall_cond_signal((smx_cond_t) cond);
+  simcall_cond_signal((smx_cond_t)cond);
 }
 
 void xbt_cond_broadcast(xbt_cond_t cond)
 {
-  simcall_cond_broadcast((smx_cond_t) cond);
+  simcall_cond_broadcast((smx_cond_t)cond);
 }
 
 void xbt_cond_destroy(xbt_cond_t cond)
 {
-  SIMIX_cond_unref((smx_cond_t) cond);
+  SIMIX_cond_unref((smx_cond_t)cond);
 }
index 0149d4f..c466975 100644 (file)
@@ -1,12 +1,4 @@
-foreach(x check_defaults stack_overflow)
-  add_executable       (${x}  ${x}/${x}.c)
-  target_link_libraries(${x}  simgrid)
-  set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
-
-  set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c)
-endforeach()
-
-foreach(x generic_simcalls)
+foreach(x check_defaults generic_simcalls stack_overflow)
   add_executable       (${x}  ${x}/${x}.cpp)
   target_link_libraries(${x}  simgrid)
   set_target_properties(${x}  PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x})
@@ -9,7 +9,7 @@
 #include "simgrid/simix.h"
 #include "xbt/log.h"
 
-int main(int argc, char *argv[])
+int main(int argc, charargv[])
 {
   xbt_log_control_set("root.fmt:[%c/%p]%e%m%n");
   xbt_log_control_set("simix_context.threshold:verbose");
@@ -26,7 +26,7 @@ static unsigned collatz(unsigned c0, unsigned n)
   return x;
 }
 
-static int master(int argc, char *argv[])
+static int master(int argc, charargv[])
 {
   XBT_INFO("Launching our nice bugged recursive function...");
   unsigned i = 1;
@@ -38,7 +38,7 @@ static int master(int argc, char *argv[])
   return 0;
 }
 
-int main(int argc, char *argv[])
+int main(int argc, charargv[])
 {
   SIMIX_global_init(&argc, argv);
 
index 16505df..3944546 100644 (file)
@@ -1,17 +1,16 @@
-/* Copyright (c) 2012-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2012-2017. 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. */
 
+#include "simgrid/msg.h"
+#include "src/internal_config.h" /* HAVE_FUTEX_H */
+#include "xbt/xbt_os_time.h"
 #include <stdio.h>
 #include <stdlib.h>
 #include <xbt/dynar.h>
 #include <xbt/parmap.h>
 #include <xbt/sysdep.h>
-#include "src/internal_config.h"        /* HAVE_FUTEX_H */
-#include "simgrid/simix.h"
-#include "xbt/xbt_os_time.h"
 
 #define MODES_DEFAULT 0x7
 #define TIMEOUT 10.0
@@ -162,7 +161,7 @@ int main(int argc, char *argv[])
   int nthreads;
   unsigned modes = MODES_DEFAULT;
 
-  SIMIX_global_init(&argc, argv);
+  MSG_init(&argc, argv);
 
   if (argc != 2 && argc != 3) {
     fprintf(stderr, "Usage: %s nthreads [modes]\n"
index e2d5faf..b520b5d 100644 (file)
@@ -1,16 +1,15 @@
 /* parmap_test -- test parmap                                               */
 
-/* Copyright (c) 2007-2010, 2013-2014. The SimGrid Team.
- * All rights reserved.                                                     */
+/* Copyright (c) 2007-2017. 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. */
 
-#include "simgrid/simix.h"
+#include "simgrid/msg.h"
+#include "src/internal_config.h"
 #include "xbt.h"
 #include "xbt/ex.h"
 #include "xbt/xbt_os_time.h"
-#include "src/internal_config.h"
 
 XBT_LOG_NEW_DEFAULT_CATEGORY(parmap_test, "Test for parmap");
 
@@ -115,7 +114,7 @@ static int test_parmap_extended(e_xbt_parmap_mode_t mode)
 int main(int argc, char** argv)
 {
   int status = 0;
-  SIMIX_global_init(&argc, argv);
+  MSG_init(&argc, argv);
 
   XBT_INFO("Basic testing posix");
   status += test_parmap_basic(XBT_PARMAP_POSIX);
index 4c2e631..f4d5b0f 100644 (file)
@@ -277,7 +277,7 @@ set(XBT_SRC
   src/xbt/xbt_log_layout_simple.c
   src/xbt/xbt_main.cpp
   src/xbt/xbt_os_file.c
-  src/xbt/xbt_os_synchro.c
+  src/xbt/xbt_os_synchro.cpp
   src/xbt/xbt_os_time.c
   src/xbt/xbt_replay.cpp
   src/xbt/xbt_str.cpp