class Semaphore;
/** Smart pointer to a simgrid::s4u::Semaphore */
using SemaphorePtr = boost::intrusive_ptr<Semaphore>;
-XBT_PUBLIC void intrusive_ptr_release(Semaphore* m);
-XBT_PUBLIC void intrusive_ptr_add_ref(Semaphore* m);
+XBT_PUBLIC void intrusive_ptr_release(const Semaphore* m);
+XBT_PUBLIC void intrusive_ptr_add_ref(const Semaphore* m);
class Disk;
} // namespace s4u
class XBT_PUBLIC ConditionVariable {
private:
friend kernel::activity::ConditionVariableImpl;
- kernel::activity::ConditionVariableImpl* const cond_;
+ kernel::activity::ConditionVariableImpl* const pimpl_;
-public:
#ifndef DOXYGEN
- explicit ConditionVariable(kernel::activity::ConditionVariableImpl* cond) : cond_(cond) {}
+ explicit ConditionVariable(kernel::activity::ConditionVariableImpl* cond) : pimpl_(cond) {}
ConditionVariable(ConditionVariable const&) = delete;
ConditionVariable& operator=(ConditionVariable const&) = delete;
friend XBT_PUBLIC void intrusive_ptr_release(const ConditionVariable* cond);
#endif
+public:
/** Create a new condition variable and return a smart pointer
*
* @beginrst
friend XBT_PUBLIC void intrusive_ptr_add_ref(const Mutex* mutex);
friend XBT_PUBLIC void intrusive_ptr_release(const Mutex* mutex);
-public:
explicit Mutex(kernel::activity::MutexImpl* mutex) : pimpl_(mutex) {}
- ~Mutex();
#ifndef DOXYGEN
Mutex(Mutex const&) = delete; // No copy constructor; Use MutexPtr instead
Mutex& operator=(Mutex const&) = delete; // No direct assignment either. Use MutexPtr instead
#endif
+public:
/** Constructs a new mutex */
static MutexPtr create();
void lock();
*
*/
class XBT_PUBLIC Semaphore {
- kernel::activity::SemaphoreImpl* const pimpl_;
- std::atomic_int_fast32_t refcount_{0};
+ friend kernel::activity::SemaphoreImpl;
- friend void intrusive_ptr_add_ref(Semaphore* sem);
- friend void intrusive_ptr_release(Semaphore* sem);
+ kernel::activity::SemaphoreImpl* const pimpl_;
-public:
- explicit Semaphore(unsigned int initial_capacity);
- ~Semaphore();
+ friend void intrusive_ptr_add_ref(const Semaphore* sem);
+ friend void intrusive_ptr_release(const Semaphore* sem);
+ explicit Semaphore(kernel::activity::SemaphoreImpl* sem) : pimpl_(sem) {}
#ifndef DOXYGEN
Semaphore(Semaphore const&) = delete; // No copy constructor. Use SemaphorePtr instead
Semaphore& operator=(Semaphore const&) = delete; // No direct assignment either. Use SemaphorePtr instead
#endif
+public:
/** Constructs a new semaphore */
static SemaphorePtr create(unsigned int initial_capacity);
void acquire();
- int acquire_timeout(double timeout);
+ bool acquire_timeout(double timeout);
void release();
int get_capacity() const;
- int would_block() const;
+ bool would_block() const;
};
} // namespace s4u
XBT_ATTRIB_DEPRECATED_v331("Please use sg_mutex_unlock()") XBT_PUBLIC void simcall_mutex_unlock(smx_mutex_t mutex);
XBT_ATTRIB_DEPRECATED_v330("Please use sg_cond_init()") XBT_PUBLIC smx_cond_t simcall_cond_init();
-XBT_PUBLIC void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
+XBT_ATTRIB_DEPRECATED_v331("Please use sg_cond_wait()") XBT_PUBLIC
+ void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex);
XBT_PUBLIC int simcall_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double max_duration);
-XBT_PUBLIC void simcall_sem_acquire(smx_sem_t sem);
+XBT_ATTRIB_DEPRECATED_v331("Please use sg_sem_acquire()") XBT_PUBLIC void simcall_sem_acquire(smx_sem_t sem);
XBT_PUBLIC int simcall_sem_acquire_timeout(smx_sem_t sem, double max_duration);
SG_END_DECL
#include "simgrid/Exception.hpp"
#include "src/kernel/activity/MutexImpl.hpp"
#include "src/kernel/activity/SynchroRaw.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
XBT_LOG_NEW_DEFAULT_SUBCATEGORY(simix_condition, simix_synchro, "Condition variables");
/********************************* Condition **********************************/
-/** @brief Handle a condition waiting simcall without timeouts */
-void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex)
-{
- cond->wait(mutex, -1, simcall->issuer_);
-}
-
/** @brief Handle a condition waiting simcall with timeouts */
void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout)
{
/* Now transform the cond wait simcall into a mutex lock one */
smx_simcall_t simcall = &proc.simcall_;
MutexImpl* simcall_mutex;
- if (simcall->call_ == simix::Simcall::COND_WAIT)
- simcall_mutex = simcall_cond_wait__get__mutex(simcall);
- else
+ if (simcall->call_ == simix::Simcall::COND_WAIT_TIMEOUT)
simcall_mutex = simcall_cond_wait_timeout__get__mutex(simcall);
+ else {
+ // FIXME? using here the MC observer to solve a problem not related to MC
+ auto* observer = dynamic_cast<mc::ConditionWaitSimcall*>(simcall->observer_);
+ xbt_assert(observer != nullptr);
+ simcall_mutex = observer->get_mutex();
+ }
simcall->call_ = simix::Simcall::RUN_BLOCKING;
simcall_mutex->lock(simcall->issuer_);
#ifndef SIMGRID_KERNEL_ACTIVITY_MUTEX_HPP
#define SIMGRID_KERNEL_ACTIVITY_MUTEX_HPP
-#include "simgrid/s4u/ConditionVariable.hpp"
+#include "simgrid/s4u/Mutex.hpp"
#include "src/kernel/actor/ActorImpl.hpp"
#include <boost/intrusive/list.hpp>
}
}
+/** Increase the refcount for this semaphore */
+SemaphoreImpl* SemaphoreImpl::ref()
+{
+ intrusive_ptr_add_ref(this);
+ return this;
+}
+
+/** Decrease the refcount for this mutex */
+void SemaphoreImpl::unref()
+{
+ intrusive_ptr_release(this);
+}
+
} // namespace activity
} // namespace kernel
} // namespace simgrid
// Simcall handlers:
-/**
- * @brief Handles a sem acquire simcall without timeout.
- */
-void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem)
-{
- sem->acquire(simcall->issuer_, -1);
-}
-
/**
* @brief Handles a sem acquire simcall with timeout.
*/
class XBT_PUBLIC SemaphoreImpl {
std::atomic_int_fast32_t refcount_{1};
+ s4u::Semaphore piface_;
unsigned int value_;
actor::SynchroList sleeping_; /* list of sleeping actors*/
public:
- explicit SemaphoreImpl(unsigned int value) : value_(value){};
+ explicit SemaphoreImpl(unsigned int value) : piface_(this), value_(value){};
SemaphoreImpl(SemaphoreImpl const&) = delete;
SemaphoreImpl& operator=(SemaphoreImpl const&) = delete;
unsigned int get_capacity() const { return value_; }
bool is_used() const { return not sleeping_.empty(); }
+ SemaphoreImpl* ref();
+ void unref();
+
friend void intrusive_ptr_add_ref(SemaphoreImpl* sem)
{
XBT_ATTRIB_UNUSED auto previous = sem->refcount_.fetch_add(1);
}
friend void intrusive_ptr_release(SemaphoreImpl* sem)
{
- if (sem->refcount_.fetch_sub(1) == 1)
+ if (sem->refcount_.fetch_sub(1) == 1) {
+ xbt_assert(not sem->is_used(), "Cannot destroy semaphore since someone is still using it");
delete sem;
+ }
}
+
+ s4u::Semaphore& sem() { return piface_; }
};
} // namespace activity
} // namespace kernel
{
return not blocking_ || mutex_->get_owner() == nullptr || mutex_->get_owner() == get_issuer();
}
+
+std::string ConditionWaitSimcall::to_string(int time_considered) const
+{
+ std::string res = SimcallObserver::to_string(time_considered) + "Condition WAIT";
+ res += "(" + (timeout_ == -1.0 ? "" : std::to_string(timeout_)) + ")";
+ return res;
+}
+
+std::string ConditionWaitSimcall::dot_label() const
+{
+ return SimcallObserver::dot_label() + "Condition WAIT";
+}
+
+bool ConditionWaitSimcall::is_enabled() const
+{
+ static bool warned = false;
+ if (not warned) {
+ XBT_INFO("Using condition variables in model-checked code is still experimental. Use at your own risk");
+ warned = true;
+ }
+ return true;
+}
+
+std::string SemAcquireSimcall::to_string(int time_considered) const
+{
+ std::string res = SimcallObserver::to_string(time_considered) + "Sem ACQUIRE";
+ res += "(" + (timeout_ == -1.0 ? "" : std::to_string(timeout_)) + ")";
+ return res;
+}
+
+std::string SemAcquireSimcall::dot_label() const
+{
+ return SimcallObserver::dot_label() + "Sem ACQUIRE";
+}
+
+bool SemAcquireSimcall::is_enabled() const
+{
+ static bool warned = false;
+ if (not warned) {
+ XBT_INFO("Using semaphore in model-checked code is still experimental. Use at your own risk");
+ warned = true;
+ }
+ return true;
+}
} // namespace mc
} // namespace simgrid
namespace mc {
class SimcallObserver {
- kernel::actor::ActorImpl* issuer_;
+ kernel::actor::ActorImpl* const issuer_;
public:
explicit SimcallObserver(kernel::actor::ActorImpl* issuer) : issuer_(issuer) {}
};
class RandomSimcall : public SimcallObserver {
- int min_;
- int max_;
+ const int min_;
+ const int max_;
int next_value_ = 0;
public:
};
class MutexLockSimcall : public SimcallObserver {
- kernel::activity::MutexImpl* mutex_;
- bool blocking_;
+ kernel::activity::MutexImpl* const mutex_;
+ const bool blocking_;
public:
MutexLockSimcall(smx_actor_t actor, kernel::activity::MutexImpl* mutex, bool blocking = true)
std::string dot_label() const override;
kernel::activity::MutexImpl* get_mutex() const { return mutex_; }
};
+
+class ConditionWaitSimcall : public SimcallObserver {
+ kernel::activity::ConditionVariableImpl* const cond_;
+ kernel::activity::MutexImpl* const mutex_;
+ const double timeout_;
+
+public:
+ ConditionWaitSimcall(smx_actor_t actor, kernel::activity::ConditionVariableImpl* cond,
+ kernel::activity::MutexImpl* mutex, double timeout = -1.0)
+ : SimcallObserver(actor), cond_(cond), mutex_(mutex), timeout_(timeout)
+ {
+ }
+ bool is_enabled() const override;
+ bool is_visible() const override { return false; }
+ std::string to_string(int times_considered) const override;
+ std::string dot_label() const override;
+ kernel::activity::ConditionVariableImpl* get_cond() const { return cond_; }
+ kernel::activity::MutexImpl* get_mutex() const { return mutex_; }
+ double get_timeout() const { return timeout_; }
+};
+
+class SemAcquireSimcall : public SimcallObserver {
+ kernel::activity::SemaphoreImpl* const sem_;
+ const double timeout_;
+
+public:
+ SemAcquireSimcall(smx_actor_t actor, kernel::activity::SemaphoreImpl* sem, double timeout = -1.0)
+ : SimcallObserver(actor), sem_(sem), timeout_(timeout)
+ {
+ }
+ bool is_enabled() const override;
+ bool is_visible() const override { return false; }
+ std::string to_string(int times_considered) const override;
+ std::string dot_label() const override;
+ kernel::activity::SemaphoreImpl* get_sem() const { return sem_; }
+ double get_timeout() const { return timeout_; }
+};
} // namespace mc
} // namespace simgrid
return false;
}
- case Simcall::SEM_ACQUIRE: {
- static bool warned = false;
- if (not warned)
- XBT_INFO("Using semaphore in model-checked code is still experimental. Use at your own risk");
- warned = true;
- return true;
- }
-
- case Simcall::COND_WAIT: {
- static bool warned = false;
- if (not warned)
- XBT_INFO("Using condition variables in model-checked code is still experimental. Use at your own risk");
- warned = true;
- return true;
- }
-
default:
/* The rest of the requests are always enabled */
return true;
#include "simgrid/s4u/ConditionVariable.hpp"
#include "simgrid/simix.h"
#include "src/kernel/activity/ConditionVariableImpl.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
#include "xbt/log.hpp"
#include <exception>
*/
void ConditionVariable::wait(MutexPtr lock)
{
- simcall_cond_wait(cond_, lock->pimpl_);
+ kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+ mc::ConditionWaitSimcall observer{issuer, pimpl_, lock->pimpl_};
+ kernel::actor::simcall_blocking<void>(
+ [&observer] { observer.get_cond()->wait(observer.get_mutex(), -1.0, observer.get_issuer()); }, &observer);
}
void ConditionVariable::wait(const std::unique_lock<Mutex>& lock)
{
- simcall_cond_wait(cond_, lock.mutex()->pimpl_);
+ kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+ mc::ConditionWaitSimcall observer{issuer, pimpl_, lock.mutex()->pimpl_};
+ kernel::actor::simcall_blocking<void>(
+ [&observer] { observer.get_cond()->wait(observer.get_mutex(), -1.0, observer.get_issuer()); }, &observer);
}
std::cv_status s4u::ConditionVariable::wait_for(const std::unique_lock<Mutex>& lock, double timeout)
if (timeout < 0)
timeout = 0.0;
- if (simcall_cond_wait_timeout(cond_, lock.mutex()->pimpl_, timeout)) {
+ if (simcall_cond_wait_timeout(pimpl_, lock.mutex()->pimpl_, timeout)) {
// If we reached the timeout, we have to take the lock again:
lock.mutex()->lock();
return std::cv_status::timeout;
*/
void ConditionVariable::notify_one()
{
- simgrid::kernel::actor::simcall([this]() { cond_->signal(); });
+ simgrid::kernel::actor::simcall([this]() { pimpl_->signal(); });
}
void ConditionVariable::notify_all()
{
- simgrid::kernel::actor::simcall([this]() { cond_->broadcast(); });
+ simgrid::kernel::actor::simcall([this]() { pimpl_->broadcast(); });
}
void intrusive_ptr_add_ref(const ConditionVariable* cond)
{
- intrusive_ptr_add_ref(cond->cond_);
+ intrusive_ptr_add_ref(cond->pimpl_);
}
void intrusive_ptr_release(const ConditionVariable* cond)
{
- intrusive_ptr_release(cond->cond_);
+ intrusive_ptr_release(cond->pimpl_);
}
} // namespace s4u
/* **************************** Public C interface *************************** */
sg_cond_t sg_cond_init()
{
- simgrid::kernel::activity::ConditionVariableImpl* cond =
- simgrid::kernel::actor::simcall([] { return new simgrid::kernel::activity::ConditionVariableImpl(); });
-
- return new simgrid::s4u::ConditionVariable(cond);
+ return simgrid::s4u::ConditionVariable::create().detach();
}
void sg_cond_wait(sg_cond_t cond, sg_mutex_t mutex)
void sg_cond_destroy(const_sg_cond_t cond)
{
- delete cond;
+ intrusive_ptr_release(cond);
}
namespace simgrid {
namespace s4u {
-Mutex::~Mutex()
-{
- if (pimpl_ != nullptr)
- pimpl_->unref();
-}
-
/** @brief Blocks the calling actor until the mutex can be obtained */
void Mutex::lock()
{
void intrusive_ptr_add_ref(const Mutex* mutex)
{
xbt_assert(mutex);
- if (mutex->pimpl_)
- mutex->pimpl_->ref();
+ mutex->pimpl_->ref();
}
void intrusive_ptr_release(const Mutex* mutex)
{
xbt_assert(mutex);
- if (mutex->pimpl_)
- mutex->pimpl_->unref();
+ mutex->pimpl_->unref();
}
} // namespace s4u
/* **************************** Public C interface *************************** */
sg_mutex_t sg_mutex_init()
{
- simgrid::kernel::activity::MutexImpl* mutex =
- simgrid::kernel::actor::simcall([] { return new simgrid::kernel::activity::MutexImpl(); });
-
- return new simgrid::s4u::Mutex(mutex);
+ return simgrid::s4u::Mutex::create().detach();
}
void sg_mutex_lock(sg_mutex_t mutex)
void sg_mutex_destroy(const_sg_mutex_t mutex)
{
- delete mutex;
+ intrusive_ptr_release(mutex);
}
#include "simgrid/forward.h"
#include "simgrid/s4u/Semaphore.hpp"
#include "src/kernel/activity/SemaphoreImpl.hpp"
+#include "src/mc/checker/SimcallObserver.hpp"
namespace simgrid {
namespace s4u {
-Semaphore::Semaphore(unsigned int initial_capacity) : pimpl_(new kernel::activity::SemaphoreImpl(initial_capacity)) {}
-
-Semaphore::~Semaphore()
-{
- xbt_assert(not pimpl_->is_used(), "Cannot destroy semaphore since someone is still using it");
- delete pimpl_;
-}
-
SemaphorePtr Semaphore::create(unsigned int initial_capacity)
{
- return SemaphorePtr(new Semaphore(initial_capacity));
+ auto* sem = new kernel::activity::SemaphoreImpl(initial_capacity);
+ return SemaphorePtr(&sem->sem(), false);
}
void Semaphore::acquire()
{
- simcall_sem_acquire(pimpl_);
+ kernel::actor::ActorImpl* issuer = kernel::actor::ActorImpl::self();
+ mc::SemAcquireSimcall observer{issuer, pimpl_};
+ kernel::actor::simcall_blocking<void>([&observer] { observer.get_sem()->acquire(observer.get_issuer(), -1.0); },
+ &observer);
}
-int Semaphore::acquire_timeout(double timeout)
+bool Semaphore::acquire_timeout(double timeout)
{
return simcall_sem_acquire_timeout(pimpl_, timeout);
}
return kernel::actor::simcall([this] { return pimpl_->get_capacity(); });
}
-int Semaphore::would_block() const
+bool Semaphore::would_block() const
{
return kernel::actor::simcall([this] { return pimpl_->would_block(); });
}
-void intrusive_ptr_add_ref(Semaphore* sem)
+/* refcounting of the intrusive_ptr is delegated to the implementation object */
+void intrusive_ptr_add_ref(const Semaphore* sem)
{
xbt_assert(sem);
- sem->refcount_.fetch_add(1, std::memory_order_relaxed);
+ sem->pimpl_->ref();
}
-void intrusive_ptr_release(Semaphore* sem)
+void intrusive_ptr_release(const Semaphore* sem)
{
xbt_assert(sem);
- if (sem->refcount_.fetch_sub(1, std::memory_order_release) == 1) {
- std::atomic_thread_fence(std::memory_order_acquire);
- delete sem;
- }
+ sem->pimpl_->unref();
}
} // namespace s4u
/** @brief creates a semaphore object of the given initial capacity */
sg_sem_t sg_sem_init(int initial_value)
{
- return new simgrid::s4u::Semaphore(initial_value);
+ return simgrid::s4u::Semaphore::create(initial_value).detach();
}
/** @brief locks on a semaphore object */
void sg_sem_destroy(const_sg_sem_t sem)
{
- delete sem;
+ intrusive_ptr_release(sem);
}
/** @brief returns a boolean indicating if this semaphore would block at this very specific time
#include "src/kernel/activity/IoImpl.hpp"
#include "src/kernel/activity/MailboxImpl.hpp"
#include "src/kernel/activity/MutexImpl.hpp"
+#include "src/kernel/activity/SemaphoreImpl.hpp"
#include "src/mc/checker/SimcallObserver.hpp"
#include "src/mc/mc_replay.hpp"
#include "src/plugins/vm/VirtualMachineImpl.hpp"
* @ingroup simix_synchro_management
*
*/
-void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
+void simcall_cond_wait(smx_cond_t cond, smx_mutex_t mutex) // XBT_ATTRIB_DEPRECATED_v331
{
- simcall_BODY_cond_wait(cond, mutex);
+ cond->get_iface()->wait(std::unique_lock<simgrid::s4u::Mutex>(mutex->mutex()));
}
/**
* @ingroup simix_synchro_management
*
*/
-void simcall_sem_acquire(smx_sem_t sem)
+void simcall_sem_acquire(smx_sem_t sem) // XBT_ATTRIB_DEPRECATD_v331
{
- simcall_BODY_sem_acquire(sem);
+ return sem->sem().acquire();
}
/**
simgrid::simix::marshal<double>(simcall->args_[1], arg);
}
-static inline smx_cond_t simcall_cond_wait__get__cond(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_cond_t>(simcall->args_[0]);
-}
-static inline smx_cond_t simcall_cond_wait__getraw__cond(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_cond_t>(simcall->args_[0]);
-}
-static inline void simcall_cond_wait__set__cond(smx_simcall_t simcall, smx_cond_t arg)
-{
- simgrid::simix::marshal<smx_cond_t>(simcall->args_[0], arg);
-}
-static inline smx_mutex_t simcall_cond_wait__get__mutex(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_mutex_t>(simcall->args_[1]);
-}
-static inline smx_mutex_t simcall_cond_wait__getraw__mutex(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_mutex_t>(simcall->args_[1]);
-}
-static inline void simcall_cond_wait__set__mutex(smx_simcall_t simcall, smx_mutex_t arg)
-{
- simgrid::simix::marshal<smx_mutex_t>(simcall->args_[1], arg);
-}
-
static inline smx_cond_t simcall_cond_wait_timeout__get__cond(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_cond_t>(simcall->args_[0]);
simgrid::simix::marshal<int>(simcall->result_, result);
}
-static inline smx_sem_t simcall_sem_acquire__get__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal<smx_sem_t>(simcall->args_[0]);
-}
-static inline smx_sem_t simcall_sem_acquire__getraw__sem(smx_simcall_t simcall)
-{
- return simgrid::simix::unmarshal_raw<smx_sem_t>(simcall->args_[0]);
-}
-static inline void simcall_sem_acquire__set__sem(smx_simcall_t simcall, smx_sem_t arg)
-{
- simgrid::simix::marshal<smx_sem_t>(simcall->args_[0], arg);
-}
-
static inline smx_sem_t simcall_sem_acquire_timeout__get__sem(smx_simcall_t simcall)
{
return simgrid::simix::unmarshal<smx_sem_t>(simcall->args_[0]);
XBT_PRIVATE void simcall_HANDLER_comm_testany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count);
XBT_PRIVATE void simcall_HANDLER_comm_waitany(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout);
XBT_PRIVATE void simcall_HANDLER_comm_wait(smx_simcall_t simcall, simgrid::kernel::activity::CommImpl* comm, double timeout);
-XBT_PRIVATE void simcall_HANDLER_cond_wait(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex);
XBT_PRIVATE void simcall_HANDLER_cond_wait_timeout(smx_simcall_t simcall, smx_cond_t cond, smx_mutex_t mutex, double timeout);
-XBT_PRIVATE void simcall_HANDLER_sem_acquire(smx_simcall_t simcall, smx_sem_t sem);
XBT_PRIVATE void simcall_HANDLER_sem_acquire_timeout(smx_simcall_t simcall, smx_sem_t sem, double timeout);
return simcall<void, simgrid::kernel::activity::CommImpl*, double>(Simcall::COMM_WAIT, comm, timeout);
}
-inline static void simcall_BODY_cond_wait(smx_cond_t cond, smx_mutex_t mutex)
-{
- if (false) /* Go to that function to follow the code flow through the simcall barrier */
- simcall_HANDLER_cond_wait(&SIMIX_process_self()->simcall_, cond, mutex);
- return simcall<void, smx_cond_t, smx_mutex_t>(Simcall::COND_WAIT, cond, mutex);
-}
-
inline static int simcall_BODY_cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
return simcall<int, smx_cond_t, smx_mutex_t, double>(Simcall::COND_WAIT_TIMEOUT, cond, mutex, timeout);
}
-inline static void simcall_BODY_sem_acquire(smx_sem_t sem)
-{
- if (false) /* Go to that function to follow the code flow through the simcall barrier */
- simcall_HANDLER_sem_acquire(&SIMIX_process_self()->simcall_, sem);
- return simcall<void, smx_sem_t>(Simcall::SEM_ACQUIRE, sem);
-}
-
inline static int simcall_BODY_sem_acquire_timeout(smx_sem_t sem, double timeout)
{
if (false) /* Go to that function to follow the code flow through the simcall barrier */
COMM_TESTANY,
COMM_WAITANY,
COMM_WAIT,
- COND_WAIT,
COND_WAIT_TIMEOUT,
- SEM_ACQUIRE,
SEM_ACQUIRE_TIMEOUT,
RUN_KERNEL,
RUN_BLOCKING,
};
-constexpr int NUM_SIMCALLS = 16;
+constexpr int NUM_SIMCALLS = 14;
} // namespace simix
} // namespace simgrid
"Simcall::COMM_TESTANY",
"Simcall::COMM_WAITANY",
"Simcall::COMM_WAIT",
- "Simcall::COND_WAIT",
"Simcall::COND_WAIT_TIMEOUT",
- "Simcall::SEM_ACQUIRE",
"Simcall::SEM_ACQUIRE_TIMEOUT",
"Simcall::RUN_KERNEL",
"Simcall::RUN_BLOCKING",
simcall_HANDLER_comm_wait(&simcall_, simgrid::simix::unmarshal<simgrid::kernel::activity::CommImpl*>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
break;
- case Simcall::COND_WAIT:
- simcall_HANDLER_cond_wait(&simcall_, simgrid::simix::unmarshal<smx_cond_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[1]));
- break;
-
case Simcall::COND_WAIT_TIMEOUT:
simcall_HANDLER_cond_wait_timeout(&simcall_, simgrid::simix::unmarshal<smx_cond_t>(simcall_.args_[0]), simgrid::simix::unmarshal<smx_mutex_t>(simcall_.args_[1]), simgrid::simix::unmarshal<double>(simcall_.args_[2]));
break;
- case Simcall::SEM_ACQUIRE:
- simcall_HANDLER_sem_acquire(&simcall_, simgrid::simix::unmarshal<smx_sem_t>(simcall_.args_[0]));
- break;
-
case Simcall::SEM_ACQUIRE_TIMEOUT:
simcall_HANDLER_sem_acquire_timeout(&simcall_, simgrid::simix::unmarshal<smx_sem_t>(simcall_.args_[0]), simgrid::simix::unmarshal<double>(simcall_.args_[1]));
break;
int comm_waitany(simgrid::kernel::activity::CommImpl** comms, size_t count, double timeout) [[block]];
void comm_wait(simgrid::kernel::activity::CommImpl* comm, double timeout) [[block]];
-void cond_wait(smx_cond_t cond, smx_mutex_t mutex) [[block]];
int cond_wait_timeout(smx_cond_t cond, smx_mutex_t mutex, double timeout) [[block]];
-void sem_acquire(smx_sem_t sem) [[block]];
int sem_acquire_timeout(smx_sem_t sem, double timeout) [[block]];
void run_kernel(std::function<void()> const* code) [[nohandler]];
#!/usr/bin/env sh
-set -e
-
-BUILDFOLDER=$WORKSPACE/build
-
die() {
echo "$@"
exit 1
}
+[ -n "$WORKSPACE" ] || die "No WORKSPACE"
+[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
+
+echo "XXXX Cleanup previous attempts. Remaining content of /tmp:"
+rm -f /tmp/cc*
+rm -f /tmp/*.so
+rm -rf /tmp/simgrid-java*
+rm -rf /var/tmp/simgrid-java*
+rm -rf /tmp/jvm-*
+find "$WORKSPACE" -name "hs_err_pid*.log" -exec rm -f {} +
+ls /tmp
+df -h
+echo "XXXX Let's go"
+
+set -e
+
+BUILDFOLDER=$WORKSPACE/build
+
### Check the node installation
pkg_check() {
### Cleanup previous runs
-[ -n "$WORKSPACE" ] || die "No WORKSPACE"
-[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
-
do_cleanup() {
for d
do
#!/usr/bin/env sh
-set -e
-
die() {
echo "$@"
exit 1
}
+[ -n "$WORKSPACE" ] || die "No WORKSPACE"
+[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
+
+echo "XXXX Cleanup previous attempts. Remaining content of /tmp:"
+rm -f /tmp/cc*
+rm -f /tmp/*.so
+rm -rf /tmp/simgrid-java*
+rm -rf /var/tmp/simgrid-java*
+rm -rf /tmp/jvm-*
+find "$WORKSPACE" -name "hs_err_pid*.log" -exec rm -f {} +
+ls /tmp
+df -h
+echo "XXXX Let's go"
+
+set -e
+
### Check the node installation
pkg_check() {
### Cleanup previous runs
-[ -n "$WORKSPACE" ] || die "No WORKSPACE"
-[ -d "$WORKSPACE" ] || die "WORKSPACE ($WORKSPACE) does not exist"
-
do_cleanup() {
for d
do
MAY_DISABLE_SOURCE_CHANGE="-DCMAKE_DISABLE_SOURCE_CHANGES=ON"
fi
-if [ "$os" = "CentOS" ] && [ "$(ld -v | cut -d\ -f4)" = "2.30-90.el8" ]; then
+if [ "$os" = "CentOS" ] && [ "$(ld -v | cut -d\ -f4 | cut -c1-4)" = "2.30" ]; then
echo "Temporary disable LTO, believed to be broken on this system."
MAY_DISABLE_LTO=-Denable_lto=OFF
else