-#include "src/surf/surf_interface.hpp"
-#include "src/simix/smx_private.h"
-#include "xbt/log.h"
-#include "mc/mc.h"
-#include "src/mc/mc_replay.h"
-#include "xbt/dict.h"
-#include "simgrid/s4u/mailbox.hpp"
-
-#include "src/simix/SynchroComm.hpp"
-
-XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_network, simix, "SIMIX network-related synchronization");
-
-static void SIMIX_mbox_free(void *data);
-static xbt_dict_t mailboxes = xbt_dict_new_homogeneous(SIMIX_mbox_free);
-
-static void SIMIX_waitany_remove_simcall_from_actions(smx_simcall_t simcall);
-static void SIMIX_comm_copy_data(smx_synchro_t comm);
-static smx_synchro_t SIMIX_comm_new(e_smx_comm_type_t type);
-static inline void SIMIX_mbox_push(smx_mailbox_t mbox, smx_synchro_t comm);
-static smx_synchro_t _find_matching_comm(std::deque<smx_synchro_t> *deque, e_smx_comm_type_t type,
- int (*match_fun)(void *, void *,smx_synchro_t), void *user_data, smx_synchro_t my_synchro, bool remove_matching);
-static void SIMIX_comm_start(smx_synchro_t synchro);
-
-void SIMIX_mailbox_exit(void)
-{
- xbt_dict_free(&mailboxes);
-}
-
-/******************************************************************************/
-/* Rendez-Vous Points */
-/******************************************************************************/
-
-smx_mailbox_t SIMIX_mbox_create(const char *name)
-{
- xbt_assert(name, "Mailboxes must have a name");
- /* two processes may have pushed the same mbox_create simcall at the same time */
- smx_mailbox_t mbox = (smx_mailbox_t) xbt_dict_get_or_null(mailboxes, name);
-
- if (!mbox) {
- mbox = xbt_new0(s_smx_mailbox_t, 1);
- mbox->name = xbt_strdup(name);
- mbox->comm_queue = new std::deque<smx_synchro_t>();
- mbox->done_comm_queue = nullptr; // Allocated on need only
- mbox->permanent_receiver=NULL;
-
- XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
- xbt_dict_set(mailboxes, mbox->name, mbox, NULL);
- }
- return mbox;
-}
-
-void SIMIX_mbox_free(void *data)
-{
- XBT_DEBUG("mbox free %p", data);
- smx_mailbox_t mbox = (smx_mailbox_t) data;
- xbt_free(mbox->name);
- delete mbox->comm_queue;
- delete mbox->done_comm_queue;
-
- xbt_free(mbox);
-}