From: Martin Quinson Date: Sun, 2 Sep 2018 00:02:21 +0000 (+0200) Subject: java: cosmetics X-Git-Tag: v3_21~122 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/b2fe69328dc3b66ce74894b58f5446514e48d53c?hp=cf680cf3d4a4d3d87dd231833e31c7e23701c6c7 java: cosmetics --- diff --git a/src/bindings/java/JavaContext.cpp b/src/bindings/java/JavaContext.cpp index 70c706906b..37c96d7225 100644 --- a/src/bindings/java/JavaContext.cpp +++ b/src/bindings/java/JavaContext.cpp @@ -38,11 +38,10 @@ JavaContext* JavaContextFactory::self() return static_cast(xbt_os_thread_get_extra_data()); } -JavaContext* JavaContextFactory::create_context( - std::function code, - void_pfn_smxprocess_t cleanup, smx_actor_t process) +JavaContext* JavaContextFactory::create_context(std::function code, void_pfn_smxprocess_t cleanup_fun, + smx_actor_t actor) { - return this->new_context(std::move(code), cleanup, process); + return this->new_context(std::move(code), cleanup_fun, actor); } void JavaContextFactory::run_all() @@ -62,7 +61,6 @@ JavaContext::JavaContext(std::function code, /* If the user provided a function for the process then use it otherwise is the context for maestro */ if (has_code()) { - this->jprocess = nullptr; this->begin = xbt_os_sem_init(0); this->end = xbt_os_sem_init(0); @@ -81,7 +79,6 @@ JavaContext::JavaContext(std::function code, std::throw_with_nested(std::move(new_exception)); } } else { - this->thread = nullptr; xbt_os_thread_set_extra_data(this); } } diff --git a/src/kernel/context/Context.cpp b/src/kernel/context/Context.cpp index 60ad8518a5..71046510aa 100644 --- a/src/kernel/context/Context.cpp +++ b/src/kernel/context/Context.cpp @@ -60,9 +60,8 @@ Context* ContextFactory::create_maestro(std::function code, smx_actor_t "Try using --cfg=contexts/factory:thread instead.\n"); } -Context::Context(std::function code, - void_pfn_smxprocess_t cleanup_func, smx_actor_t process) - : code_(std::move(code)), process_(process), iwannadie(false) +Context::Context(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor) + : code_(std::move(code)), actor_(actor) { /* If the user provided a function for the process then use it. Otherwise, it is the context for maestro and we should set it as the @@ -78,11 +77,11 @@ Context::~Context() = default; void Context::stop() { if (this->cleanup_func_) - this->cleanup_func_(this->process_); - this->process_->suspended_ = 0; + this->cleanup_func_(this->actor_); + this->actor_->suspended_ = 0; this->iwannadie = false; - simgrid::simix::simcall([this] { SIMIX_process_cleanup(this->process_); }); + simgrid::simix::simcall([this] { SIMIX_process_cleanup(this->actor_); }); this->iwannadie = true; } diff --git a/src/kernel/context/Context.hpp b/src/kernel/context/Context.hpp index 082677c08c..50f140cfbc 100644 --- a/src/kernel/context/Context.hpp +++ b/src/kernel/context/Context.hpp @@ -52,7 +52,7 @@ class XBT_PUBLIC Context { private: std::function code_; void_pfn_smxprocess_t cleanup_func_ = nullptr; - smx_actor_t process_ = nullptr; + smx_actor_t actor_ = nullptr; public: class StopRequest { @@ -68,7 +68,7 @@ public: private: std::string msg_; }; - bool iwannadie; + bool iwannadie = false; Context(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process); Context(const Context&) = delete; @@ -76,7 +76,7 @@ public: void operator()() { code_(); } bool has_code() const { return static_cast(code_); } - smx_actor_t process() { return this->process_; } + smx_actor_t process() { return this->actor_; } void set_cleanup(void_pfn_smxprocess_t cleanup) { cleanup_func_ = cleanup; } // Virtual methods @@ -87,8 +87,8 @@ public: class XBT_PUBLIC AttachContext : public Context { public: - AttachContext(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process) - : Context(std::move(code), cleanup_func, process) + AttachContext(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t actor) + : Context(std::move(code), cleanup_func, actor) { } diff --git a/src/kernel/context/ContextThread.cpp b/src/kernel/context/ContextThread.cpp index 15a9ef7fc0..008f641cc5 100644 --- a/src/kernel/context/ContextThread.cpp +++ b/src/kernel/context/ContextThread.cpp @@ -58,9 +58,8 @@ void ThreadContextFactory::run_all() // ThreadContext -ThreadContext::ThreadContext(std::function code, void_pfn_smxprocess_t cleanup, smx_actor_t process, - bool maestro) - : AttachContext(std::move(code), cleanup, process), is_maestro_(maestro) +ThreadContext::ThreadContext(std::function code, void_pfn_smxprocess_t cleanup, smx_actor_t actor, bool maestro) + : AttachContext(std::move(code), cleanup, actor), is_maestro_(maestro) { // We do not need the semaphores when maestro is in main, // but creating them anyway simplifies things when maestro is externalized