static_cast<simgrid::kernel::activity::Comm*>(temp_synchro.getBuffer());
char* remote_name = mc_model_checker->process().read<char*>(
- (std::uint64_t)(synchro->mbox ? &synchro->mbox->name : &synchro->mbox_cpy->name));
+ (std::uint64_t)(synchro->mbox ? &synchro->mbox->name_ : &synchro->mbox_cpy->name_));
pattern->rdv = mc_model_checker->process().read_string(remote_name);
pattern->src_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(synchro->src_proc))->pid;
pattern->src_host = MC_smx_actor_get_host_name(issuer);
simgrid::kernel::activity::Comm* comm = temp_comm.getBuffer();
char* remote_name;
- mc_model_checker->process().read(&remote_name,
- remote(comm->mbox ? &comm->mbox->name : &comm->mbox_cpy->name));
+ mc_model_checker->process().read(&remote_name, remote(comm->mbox ? &comm->mbox->name_ : &comm->mbox_cpy->name_));
pattern->rdv = mc_model_checker->process().read_string(remote_name);
pattern->dst_proc = mc_model_checker->process().resolveActor(simgrid::mc::remote(comm->dst_proc))->pid;
pattern->dst_host = MC_smx_actor_get_host_name(issuer);
namespace s4u {
const char *Mailbox::name() {
- return pimpl_->name;
+ return pimpl_->name_;
}
MailboxPtr Mailbox::byName(const char*name)
--- /dev/null
+/* 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 "src/simix/MailboxImpl.hpp"
+#include "src/kernel/activity/SynchroComm.hpp"
+
+XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_mailbox, simix, "Mailbox implementation");
+
+static void SIMIX_mbox_free(void* data);
+static xbt_dict_t mailboxes = xbt_dict_new_homogeneous(SIMIX_mbox_free);
+
+void SIMIX_mailbox_exit()
+{
+ 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 = static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
+ if (!mbox) {
+ mbox = new simgrid::simix::MailboxImpl(name);
+ XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
+ xbt_dict_set(mailboxes, mbox->name_, mbox, nullptr);
+ }
+ return mbox;
+}
+
+void SIMIX_mbox_free(void* data)
+{
+ XBT_DEBUG("mbox free %p", data);
+ smx_mailbox_t mbox = static_cast<smx_mailbox_t>(data);
+ delete mbox;
+}
+
+smx_mailbox_t SIMIX_mbox_get_by_name(const char* name)
+{
+ return static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
+}
+
+/**
+ * \brief set the receiver of the rendez vous point to allow eager sends
+ * \param mbox The rendez-vous point
+ * \param process The receiving process
+ */
+void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_actor_t process)
+{
+ mbox->permanent_receiver = process;
+}
+
+/**
+ * \brief Pushes a communication synchro into a rendez-vous point
+ * \param mbox The mailbox
+ * \param synchro The communication synchro
+ */
+void SIMIX_mbox_push(smx_mailbox_t mbox, smx_activity_t synchro)
+{
+ simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+ mbox->comm_queue.push_back(comm);
+ comm->mbox = mbox;
+}
+
+/**
+ * \brief Removes a communication synchro from a rendez-vous point
+ * \param mbox The rendez-vous point
+ * \param synchro The communication synchro
+ */
+void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_activity_t synchro)
+{
+ simgrid::kernel::activity::Comm* comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
+
+ comm->mbox = nullptr;
+ for (auto it = mbox->comm_queue.begin(); it != mbox->comm_queue.end(); it++)
+ if (*it == comm) {
+ mbox->comm_queue.erase(it);
+ return;
+ }
+ xbt_die("Cannot remove the comm %p that is not part of the mailbox %s", comm, mbox->name_);
+}
--- /dev/null
+/* 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. */
+
+#ifndef SIMIX_MAILBOXIMPL_H
+#define SIMIX_MAILBOXIMPL_H
+
+#include <boost/circular_buffer.hpp>
+
+#include "simgrid/s4u/Mailbox.hpp"
+#include "src/simix/ActorImpl.hpp"
+
+#define MAX_MAILBOX_SIZE 10000000
+namespace simgrid {
+namespace simix {
+
+/** @brief Rendez-vous point datatype */
+
+class MailboxImpl {
+public:
+ MailboxImpl(const char* name)
+ : piface_(this), name_(xbt_strdup(name)), comm_queue(MAX_MAILBOX_SIZE), done_comm_queue(MAX_MAILBOX_SIZE)
+ {
+ }
+ ~MailboxImpl() { xbt_free(name_); }
+
+ simgrid::s4u::Mailbox piface_; // Our interface
+ char* name_;
+ boost::circular_buffer_space_optimized<smx_activity_t> comm_queue;
+ boost::intrusive_ptr<simgrid::simix::ActorImpl> permanent_receiver; //process which the mailbox is attached to
+ boost::circular_buffer_space_optimized<smx_activity_t> done_comm_queue;//messages already received in the permanent receive mode
+};
+}
+}
+
+XBT_PRIVATE void SIMIX_mailbox_exit();
+
+XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char* name);
+XBT_PRIVATE smx_mailbox_t SIMIX_mbox_get_by_name(const char* name);
+XBT_PRIVATE void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_activity_t comm);
+XBT_PRIVATE void SIMIX_mbox_push(smx_mailbox_t mbox, smx_activity_t synchro);
+
+XBT_PRIVATE void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_actor_t proc);
+
+#endif /* SIMIX_MAILBOXIMPL_H */
-/* 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. */
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_activity_t comm);
-static inline void SIMIX_mbox_push(smx_mailbox_t mbox, smx_activity_t comm);
+static void SIMIX_comm_start(smx_activity_t synchro);
static smx_activity_t _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 *user_data, smx_activity_t my_synchro, bool remove_matching);
-static void SIMIX_comm_start(smx_activity_t synchro);
-
-void SIMIX_mailbox_exit()
-{
- 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 = static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
- if (!mbox) {
- mbox = new simgrid::simix::MailboxImpl(name);
- XBT_DEBUG("Creating a mailbox at %p with name %s", mbox, name);
- xbt_dict_set(mailboxes, mbox->name, mbox, nullptr);
- }
- return mbox;
-}
-
-void SIMIX_mbox_free(void *data)
-{
- XBT_DEBUG("mbox free %p", data);
- smx_mailbox_t mbox = static_cast<smx_mailbox_t>(data);
- delete mbox;
-}
-
-smx_mailbox_t SIMIX_mbox_get_by_name(const char *name)
-{
- return static_cast<smx_mailbox_t>(xbt_dict_get_or_null(mailboxes, name));
-}
-
-/**
- * \brief set the receiver of the rendez vous point to allow eager sends
- * \param mbox The rendez-vous point
- * \param process The receiving process
- */
-void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_actor_t process)
-{
- mbox->permanent_receiver = process;
-}
-
-/**
- * \brief Pushes a communication synchro into a rendez-vous point
- * \param mbox The mailbox
- * \param synchro The communication synchro
- */
-static inline void SIMIX_mbox_push(smx_mailbox_t mbox, smx_activity_t synchro)
-{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
- mbox->comm_queue.push_back(comm);
- comm->mbox = mbox;
-}
-
-/**
- * \brief Removes a communication synchro from a rendez-vous point
- * \param mbox The rendez-vous point
- * \param synchro The communication synchro
- */
-void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_activity_t synchro)
-{
- simgrid::kernel::activity::Comm *comm = static_cast<simgrid::kernel::activity::Comm*>(synchro);
-
- comm->mbox = nullptr;
- for (auto it = mbox->comm_queue.begin(); it != mbox->comm_queue.end(); it++)
- if (*it == comm) {
- mbox->comm_queue. erase(it);
- return;
- }
- xbt_die("Cannot remove the comm %p that is not part of the mailbox %s",comm, mbox->name);
-}
/**
* \brief Checks if there is a communication synchro queued in a deque matching our needs
#ifndef _SIMIX_NETWORK_PRIVATE_H
#define _SIMIX_NETWORK_PRIVATE_H
-#include <boost/circular_buffer.hpp>
-
#include "simgrid/s4u/Mailbox.hpp"
-
#include "src/simix/ActorImpl.hpp"
+#include "src/simix/MailboxImpl.hpp"
-
-#define MAX_MAILBOX_SIZE 10000000
-namespace simgrid {
-namespace simix {
-
-/** @brief Rendez-vous point datatype */
-
-class MailboxImpl {
-public:
- MailboxImpl(const char* name)
- : piface_(this), name(xbt_strdup(name)), comm_queue(MAX_MAILBOX_SIZE), done_comm_queue(MAX_MAILBOX_SIZE)
- {
- }
- ~MailboxImpl() { xbt_free(name); }
-
- simgrid::s4u::Mailbox piface_; // Our interface
- char* name;
- boost::circular_buffer_space_optimized<smx_activity_t> comm_queue;
- boost::intrusive_ptr<simgrid::simix::ActorImpl> permanent_receiver; //process which the mailbox is attached to
- boost::circular_buffer_space_optimized<smx_activity_t> done_comm_queue;//messages already received in the permanent receive mode
-};
-
-}
-}
-
-XBT_PRIVATE void SIMIX_mailbox_exit();
-
-XBT_PRIVATE smx_mailbox_t SIMIX_mbox_create(const char *name);
-XBT_PRIVATE smx_mailbox_t SIMIX_mbox_get_by_name(const char *name);
-XBT_PRIVATE void SIMIX_mbox_remove(smx_mailbox_t mbox, smx_activity_t comm);
-
-XBT_PRIVATE void SIMIX_mbox_set_receiver(smx_mailbox_t mbox, smx_actor_t proc);
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),
src/simix/smx_io_private.h
src/simix/smx_network_private.h
src/simix/smx_private.h
- src/simix/ActorImpl.hpp
src/simix/smx_synchro_private.h
src/kernel/activity/ActivityImpl.hpp
src/kernel/activity/SynchroComm.hpp
src/simix/smx_io.cpp
src/simix/smx_network.cpp
src/simix/ActorImpl.cpp
+ src/simix/ActorImpl.hpp
+ src/simix/MailboxImpl.cpp
+ src/simix/MailboxImpl.hpp
src/simix/smx_synchro.cpp
src/simix/popping.cpp
src/kernel/activity/ActivityImpl.cpp