if (rank == 0) {
printf("MPI_ISend / MPI_IRecv Test \n");
- for(int i=0; i < size - 1; i++){
+ for (int i = 0; i < size - 1; i++) {
MPI_Recv(&recv_buff, 1, MPI_INT, MPI_ANY_SOURCE, MPI_ANY_TAG, MPI_COMM_WORLD, &status);
printf("Message received from %d\n", recv_buff);
}
*/
XBT_PUBLIC_CLASS Mutex {
friend ConditionVariable;
- friend simgrid::simix::Mutex;
- simgrid::simix::Mutex* mutex_;
- Mutex(simgrid::simix::Mutex* mutex) : mutex_(mutex) {}
+ friend simgrid::simix::MutexImpl;
+ simgrid::simix::MutexImpl* mutex_;
+ Mutex(simgrid::simix::MutexImpl * mutex) : mutex_(mutex) {}
/* refcounting of the intrusive_ptr is delegated to the implementation object */
friend void intrusive_ptr_add_ref(Mutex* mutex)
\see m_process_management
@{ */
class ActorImpl;
- class Mutex;
+ class MutexImpl;
}
}
typedef simgrid::kernel::context::Context* smx_context_t;
typedef simgrid::simix::ActorImpl* smx_actor_t;
-typedef simgrid::simix::Mutex* smx_mutex_t;
+typedef simgrid::simix::MutexImpl* smx_mutex_t;
typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t;
#else
case SIMCALL_MUTEX_LOCK: {
smx_mutex_t mutex = simcall_mutex_lock__get__mutex(req);
#if SIMGRID_HAVE_MC
- simgrid::mc::Remote<simgrid::simix::Mutex> temp_mutex;
+ simgrid::mc::Remote<simgrid::simix::MutexImpl> temp_mutex;
if (mc_model_checker != nullptr) {
mc_model_checker->process().read(temp_mutex.getBuffer(), remote(mutex));
mutex = temp_mutex.getBuffer();
else
type = "Mutex TRYLOCK";
- simgrid::mc::Remote<simgrid::simix::Mutex> mutex;
+ simgrid::mc::Remote<simgrid::simix::MutexImpl> mutex;
mc_model_checker->process().read_bytes(mutex.getBuffer(), sizeof(mutex),
remote(
req->call == SIMCALL_MUTEX_LOCK
ActorPtr Actor::createActor(const char* name, s4u::Host* host, std::function<void()> code)
{
- smx_actor_t actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+ simgrid::simix::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
return actor->iface();
}
{
simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
simgrid::simix::ActorCode code = factory(std::move(args));
- smx_actor_t actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
+ simgrid::simix::ActorImpl* actor = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
return actor->iface();
}
namespace simgrid {
namespace simix {
-Mutex::Mutex() : mutex_(this)
+MutexImpl::MutexImpl() : mutex_(this)
{
XBT_IN("(%p)", this);
// Useful to initialize sleeping swag:
XBT_OUT();
}
-Mutex::~Mutex()
+MutexImpl::~MutexImpl()
{
XBT_IN("(%p)", this);
xbt_swag_free(this->sleeping);
XBT_OUT();
}
-void Mutex::lock(smx_actor_t issuer)
+void MutexImpl::lock(smx_actor_t issuer)
{
XBT_IN("(%p; %p)", this, issuer);
/* FIXME: check where to validate the arguments */
* \param issuer the process that tries to acquire the mutex
* \return whether we managed to lock the mutex
*/
-bool Mutex::try_lock(smx_actor_t issuer)
+bool MutexImpl::try_lock(smx_actor_t issuer)
{
XBT_IN("(%p, %p)", this, issuer);
if (this->locked) {
* If the unlocker is not the owner of the mutex nothing happens.
* If there are no process waiting, it sets the mutex as free.
*/
-void Mutex::unlock(smx_actor_t issuer)
+void MutexImpl::unlock(smx_actor_t issuer)
{
XBT_IN("(%p, %p)", this, issuer);
if (not this->locked)
smx_mutex_t simcall_HANDLER_mutex_init(smx_simcall_t simcall)
{
- return new simgrid::simix::Mutex();
+ return new simgrid::simix::MutexImpl();
}
// Simcall handlers:
namespace simgrid {
namespace simix {
-class XBT_PUBLIC() Mutex {
+class XBT_PUBLIC() MutexImpl {
public:
- Mutex();
- ~Mutex();
- Mutex(Mutex const&) = delete;
- Mutex& operator=(Mutex const&) = delete;
+ MutexImpl();
+ ~MutexImpl();
+ MutexImpl(MutexImpl const&) = delete;
+ MutexImpl& operator=(MutexImpl const&) = delete;
void lock(smx_actor_t issuer);
bool try_lock(smx_actor_t issuer);
xbt_swag_t sleeping = nullptr;
// boost::intrusive_ptr<Mutex> support:
- friend void intrusive_ptr_add_ref(Mutex* mutex)
+ friend void intrusive_ptr_add_ref(MutexImpl* mutex)
{
// Atomic operation! Do not split in two instructions!
auto previous = (mutex->refcount_)++;
xbt_assert(previous != 0);
(void) previous;
}
- friend void intrusive_ptr_release(Mutex* mutex)
+ friend void intrusive_ptr_release(MutexImpl* mutex)
{
// Atomic operation! Do not split in two instructions!
auto count = --(mutex->refcount_);