#include "mc/mc.h"
#include "src/mc/mc_ignore.h"
#include "src/simix/ActorImpl.hpp"
-#include "src/simix/smx_private.h"
+#include "src/simix/smx_private.hpp"
#include "xbt/parmap.hpp"
/** Many integers are needed to store a pointer
UContext(std::function<void()> code,
void_pfn_smxprocess_t cleanup_func, smx_actor_t process);
~UContext() override;
+ void stop() override;
};
class SerialUContext : public UContext {
void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
: UContext(std::move(code), cleanup_func, process)
{}
- void stop() override;
void suspend() override;
void resume();
};
void_pfn_smxprocess_t cleanup_func, smx_actor_t process)
: UContext(std::move(code), cleanup_func, process)
{}
- void stop() override;
void suspend() override;
void resume();
};
SIMIX_context_stack_delete(this->stack_);
}
+void UContext::stop()
+{
+ Context::stop();
+ throw StopRequest();
+}
}}} // namespace simgrid::kernel::context
static void smx_ctx_sysv_wrapper(int first, ...)
}
memcpy(&context, ctx_addr, sizeof(simgrid::kernel::context::UContext*));
- (*context)();
- context->stop();
+ try {
+ (*context)();
+ context->Context::stop();
+ } catch (simgrid::kernel::context::Context::StopRequest const&) {
+ XBT_DEBUG("Caught a StopRequest");
+ }
+ context->suspend();
}
namespace simgrid {
namespace kernel {
namespace context {
-void SerialUContext::stop()
-{
- Context::stop();
- this->suspend();
-}
-
void SerialUContext::suspend()
{
/* determine the next context */
swapcontext(&static_cast<SerialUContext*>(sysv_maestro_context)->uc_, &this->uc_);
}
-void ParallelUContext::stop()
-{
- UContext::stop();
- this->suspend();
-}
-
/** Run one particular simulated process on the current thread. */
void ParallelUContext::resume()
{