X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/247fba2eee61dc2a8e06c6f1339437dcb4481c3b..4d02714ee138a3bd9b02e0064b7a2aa26407e9e8:/src/kernel/context/Context.hpp diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 42a1ca4552..97b99e22ac 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -19,6 +19,8 @@ namespace context { class XBT_PUBLIC ContextFactory { public: explicit ContextFactory() {} + ContextFactory(const ContextFactory&) = delete; + ContextFactory& operator=(const ContextFactory&) = delete; virtual ~ContextFactory(); virtual Context* create_context(std::function code, smx_actor_t actor) = 0; @@ -41,7 +43,6 @@ protected: class XBT_PUBLIC Context { friend ContextFactory; -private: std::function code_; smx_actor_t actor_ = nullptr; void declare_context(std::size_t size); @@ -72,7 +73,8 @@ public: class XBT_PUBLIC AttachContext : public Context { public: AttachContext(std::function code, smx_actor_t actor) : Context(std::move(code), actor) {} - + AttachContext(const AttachContext&) = delete; + AttachContext& operator=(const AttachContext&) = delete; ~AttachContext() override; /** Called by the context when it is ready to give control @@ -84,24 +86,6 @@ public: virtual void attach_stop() = 0; }; -class XBT_PUBLIC StopRequest { - /** @brief Exception launched to kill a process, in order to properly unwind its stack and release RAII stuff - * - * Nope, Sonar, this should not inherit of std::exception nor of simgrid::Exception. - * Otherwise, users may accidentally catch it with a try {} catch (std::exception) - */ -public: - StopRequest() = default; - explicit StopRequest(const std::string& msg) : msg_(std::string("Actor killed (") + msg + std::string(").")) {} - ~StopRequest(); - const char* what() const noexcept { return msg_.c_str(); } - - static void do_throw(); - static bool try_n_catch(std::function try_block); - -private: - std::string msg_ = std::string("Actor killed."); -}; /* This allows Java to hijack the context factory (Java induces factories of factory :) */ typedef ContextFactory* (*ContextFactoryInitializer)();