X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/a57f4208147d6350deb00455826fbf8fd6d2f22e..9b4ac8fd04e749d0737479e3b02074be4ad3f2ab:/src/bindings/java/JavaContext.cpp diff --git a/src/bindings/java/JavaContext.cpp b/src/bindings/java/JavaContext.cpp index f65f7e61ad..ad355eb868 100644 --- a/src/bindings/java/JavaContext.cpp +++ b/src/bindings/java/JavaContext.cpp @@ -29,15 +29,14 @@ ContextFactory* java_factory() JavaContextFactory::JavaContextFactory() : ContextFactory() { - xbt_binary_name = xbt_strdup("java"); // Used by the backtrace displayer + xbt_assert(xbt_binary_name && strcmp(xbt_binary_name, "java") == 0); // Set by Java_org_simgrid_msg_Msg_init } JavaContextFactory::~JavaContextFactory()=default; -JavaContext* JavaContextFactory::create_context(std::function code, void_pfn_smxprocess_t cleanup_fun, - smx_actor_t actor) +Context* JavaContextFactory::create_context(std::function&& code, actor::ActorImpl* actor) { - return this->new_context(std::move(code), cleanup_fun, actor); + return this->new_context(std::move(code), actor); } void JavaContextFactory::run_all() @@ -45,8 +44,8 @@ void JavaContextFactory::run_all() SerialThreadContext::run_all(); } -JavaContext::JavaContext(std::function code, void_pfn_smxprocess_t cleanup_func, smx_actor_t process) - : SerialThreadContext(std::move(code), cleanup_func, process, false /* not maestro */) +JavaContext::JavaContext(std::function&& code, smx_actor_t actor) + : SerialThreadContext(std::move(code), actor, false /* not maestro */) { /* ThreadContext already does all we need */ } @@ -62,7 +61,7 @@ void JavaContext::start_hook() this->jenv_ = env; } -void JavaContext::stop() +void JavaContext::stop_hook() { JNIEnv* env = this->jenv_; env->DeleteGlobalRef(this->jprocess_); @@ -75,10 +74,8 @@ void JavaContext::stop() * until run_jprocess(), IIUC. */ jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed"); - // XBT_ERROR("Cannot detach the current thread"); - // simgrid::xbt::Backtrace().display(); + XBT_DEBUG("Cannot detach the current thread"); } - ThreadContext::stop(); } }}} // namespace simgrid::kernel::context