Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
tiny factorizations and doc improvements
authorMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 11 Nov 2018 03:23:03 +0000 (04:23 +0100)
committerMartin Quinson <martin.quinson@ens-rennes.fr>
Sun, 11 Nov 2018 04:29:30 +0000 (05:29 +0100)
src/bindings/java/jmsg_process.cpp
src/s4u/s4u_Actor.cpp
src/simix/ActorImpl.cpp

index 1d2e22a..5485918 100644 (file)
@@ -73,16 +73,15 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv* env, jobject
   /* Actually build the MSG process */
   jstring jname         = (jstring)env->GetObjectField(jprocess, jprocess_field_Process_name);
   const char* name      = env->GetStringUTFChars(jname, 0);
   /* Actually build the MSG process */
   jstring jname         = (jstring)env->GetObjectField(jprocess, jprocess_field_Process_name);
   const char* name      = env->GetStringUTFChars(jname, 0);
+  simgrid::simix::ActorCode function = [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); };
   smx_actor_t actor =
   smx_actor_t actor =
-      simcall_process_create(name, [jprocess]() { simgrid::kernel::context::java_main_jprocess(jprocess); },
-                             /*data*/ nullptr, jhost_get_native(env, jhost), /* properties*/ nullptr);
+      simcall_process_create(name, function, /*data*/ nullptr, jhost_get_native(env, jhost), /* properties*/ nullptr);
   MSG_process_yield();
 
   env->ReleaseStringUTFChars(jname, name);
 
   /* Retrieve the kill time from the process */
   MSG_process_yield();
 
   env->ReleaseStringUTFChars(jname, name);
 
   /* Retrieve the kill time from the process */
-  jdouble jkill = env->GetDoubleField(jprocess, jprocess_field_Process_killTime);
-  actor->ciface()->set_kill_time((double)jkill);
+  actor->ciface()->set_kill_time((double)env->GetDoubleField(jprocess, jprocess_field_Process_killTime));
 
   /* sets the PID and the PPID of the process */
   env->SetIntField(jprocess, jprocess_field_Process_pid, (jint)actor->ciface()->get_pid());
 
   /* sets the PID and the PPID of the process */
   env->SetIntField(jprocess, jprocess_field_Process_pid, (jint)actor->ciface()->get_pid());
index 506841b..816540b 100644 (file)
@@ -47,9 +47,7 @@ ActorPtr Actor::create(std::string name, s4u::Host* host, std::function<void()>
 ActorPtr Actor::create(std::string name, s4u::Host* host, std::string function, std::vector<std::string> args)
 {
   simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
 ActorPtr Actor::create(std::string name, s4u::Host* host, std::string function, std::vector<std::string> args)
 {
   simgrid::simix::ActorCodeFactory& factory = SIMIX_get_actor_code_factory(function);
-  simgrid::simix::ActorCode code            = factory(std::move(args));
-  simgrid::kernel::actor::ActorImpl* actor  = simcall_process_create(name, std::move(code), nullptr, host, nullptr);
-  return actor->iface();
+  return create(name, host, std::move(factory(std::move(args))));
 }
 
 void intrusive_ptr_add_ref(Actor* actor)
 }
 
 void intrusive_ptr_add_ref(Actor* actor)
index f1ccd3c..7c3ee49 100644 (file)
@@ -853,8 +853,6 @@ void SIMIX_process_on_exit(smx_actor_t process, std::function<void(int, void*)>
  * be nullptr.
  * It can be retrieved with the method ActorImpl::getUserData().
  * @param host where the new agent is executed.
  * be nullptr.
  * It can be retrieved with the method ActorImpl::getUserData().
  * @param host where the new agent is executed.
- * @param argc first argument passed to @a code
- * @param argv second argument passed to @a code
  * @param properties the properties of the process
  */
 smx_actor_t simcall_process_create(std::string name, simgrid::simix::ActorCode code, void* data, sg_host_t host,
  * @param properties the properties of the process
  */
 smx_actor_t simcall_process_create(std::string name, simgrid::simix::ActorCode code, void* data, sg_host_t host,