Avoids a second initialization of Engine after the end.
See e.g. with teshsuite/s4u/actor-suspend
/** @brief Retrieve the engine singleton */
static s4u::Engine* get_instance();
static s4u::Engine* get_instance(int* argc, char** argv);
+ static bool has_instance() { return instance_ != nullptr; }
void load_platform(const std::string& platf) const;
/** @brief Get list of all models managed by this engine */
const std::vector<resource::Model*>& get_all_models() const { return models_; }
+ static bool has_instance() { return s4u::Engine::has_instance(); }
static EngineImpl* get_instance() { return s4u::Engine::get_instance()->pimpl; }
static EngineImpl* get_instance(int* argc, char** argv) { return s4u::Engine::get_instance(argc, argv)->pimpl; }
ActorImpl::~ActorImpl()
{
- if (not EngineImpl::get_instance()->is_maestro(this))
+ if (EngineImpl::has_instance() && not EngineImpl::get_instance()->is_maestro(this))
s4u::Actor::on_destruction(*get_ciface());
}