/* 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 =
- 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 */
- 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());
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)
* 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,