X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/05b84555fa616971fccb6579c2e7b4f2321c42b9..207e186001374b77093f4064a2a25a9c626a989d:/src/kernel/context/Context.hpp diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 5c9de3ec0d..c543f410cc 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -34,25 +34,27 @@ public: virtual Context* create_maestro(std::function code, smx_actor_t process); virtual void run_all() = 0; + /** @brief Returns the current context of this thread. */ virtual Context* self(); std::string const& name() const { return name_; } -private: - void declare_context(void* T, std::size_t size); protected: template T* new_context(Args&&... args) { T* context = new T(std::forward(args)...); - this->declare_context(context, sizeof(T)); + context->declare_context(sizeof(T)); return context; } }; class XBT_PUBLIC Context { + friend ContextFactory; + private: std::function code_; void_pfn_smxprocess_t cleanup_func_ = nullptr; smx_actor_t actor_ = nullptr; + void declare_context(std::size_t size); public: class StopRequest { @@ -145,7 +147,6 @@ XBT_PRIVATE void *SIMIX_context_stack_new(); XBT_PRIVATE void SIMIX_context_stack_delete(void *stack); XBT_PUBLIC void SIMIX_context_set_current(smx_context_t context); -XBT_PRIVATE smx_context_t SIMIX_context_get_current(); XBT_PUBLIC int SIMIX_process_get_maxpid();