From: Martin Quinson Date: Mon, 13 Mar 2017 02:02:32 +0000 (+0100) Subject: make msg_process_t point onto s4u::Actor* X-Git-Tag: v3_15~138 X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/commitdiff_plain/5180ef8a951643b07bf2d6f8b8f13138fff7389b make msg_process_t point onto s4u::Actor* One day, all msg_blah_t will point to s4u::Blah*. (I'm glad it worked: that's the second time I attempt this improvement!) Other changes on the way: - change the prototype of MSG_host_get_process_list(): it was returning the internal list, but this one contains smx_actor_t, not msg_process_t as we can handle from the public interface - convert a C test in teshsuite to C++ (even if I could have avoided this) --- diff --git a/include/simgrid/msg.h b/include/simgrid/msg.h index 8bf566d858..0c0a6bb386 100644 --- a/include/simgrid/msg.h +++ b/include/simgrid/msg.h @@ -134,7 +134,7 @@ typedef struct msg_comm *msg_comm_t; structure, but always use the provided API to interact with processes. */ -typedef smx_actor_t msg_process_t; +typedef s4u_Actor* msg_process_t; /** @brief Return code of most MSG functions @ingroup msg_simulation @@ -241,7 +241,7 @@ XBT_PUBLIC(void) MSG_host_off(msg_host_t host); XBT_PUBLIC(msg_host_t) MSG_host_self(); XBT_PUBLIC(double) MSG_host_get_speed(msg_host_t h); XBT_PUBLIC(int) MSG_host_get_core_number(msg_host_t h); -XBT_PUBLIC(xbt_swag_t) MSG_host_get_process_list(msg_host_t h); +XBT_PUBLIC(void) MSG_host_get_process_list(msg_host_t h, xbt_dynar_t whereto); XBT_PUBLIC(int) MSG_host_is_on(msg_host_t h); XBT_PUBLIC(int) MSG_host_is_off(msg_host_t h); diff --git a/include/simgrid/s4u/Actor.hpp b/include/simgrid/s4u/Actor.hpp index 9b28492c3f..c7acc5b97a 100644 --- a/include/simgrid/s4u/Actor.hpp +++ b/include/simgrid/s4u/Actor.hpp @@ -244,7 +244,6 @@ public: /** Ask kindly to all actors to die. Only the issuer will survive. */ static void killAll(); -protected: /** Returns the internal implementation of this actor */ simix::ActorImpl* getImpl(); }; diff --git a/include/simgrid/simix.h b/include/simgrid/simix.h index 69c50e74b5..6a3abc9998 100644 --- a/include/simgrid/simix.h +++ b/include/simgrid/simix.h @@ -39,9 +39,9 @@ namespace context { } } -typedef simgrid::kernel::context::Context *smx_context_t; -typedef simgrid::simix::ActorImpl *smx_actor_t; -typedef simgrid::simix::Mutex *smx_mutex_t; +typedef simgrid::kernel::context::Context* smx_context_t; +typedef simgrid::simix::ActorImpl* smx_actor_t; +typedef simgrid::simix::Mutex* smx_mutex_t; typedef simgrid::kernel::activity::MailboxImpl* smx_mailbox_t; #else diff --git a/src/bindings/java/jmsg.cpp b/src/bindings/java/jmsg.cpp index bd23d38733..56ba7abdb9 100644 --- a/src/bindings/java/jmsg.cpp +++ b/src/bindings/java/jmsg.cpp @@ -329,7 +329,7 @@ void java_main_jprocess(jobject jprocess) JNIEnv *env = get_current_thread_env(); simgrid::kernel::context::JavaContext* context = static_cast(SIMIX_context_self()); context->jprocess = jprocess; - smx_actor_t process = SIMIX_process_self(); + msg_process_t process = MSG_process_self(); jprocess_bind(context->jprocess, process, env); // Adrien, ugly path, just to bypass creation of context at low levels (i.e such as for the VM migration for instance) diff --git a/src/bindings/java/jmsg_process.cpp b/src/bindings/java/jmsg_process.cpp index 3181faf080..4d0b4b6992 100644 --- a/src/bindings/java/jmsg_process.cpp +++ b/src/bindings/java/jmsg_process.cpp @@ -106,7 +106,7 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_create(JNIEnv * env, jobject /* Actually build the MSG process */ process = MSG_process_create_with_environment(name, [](int argc, char** argv) -> int { - smx_actor_t process = SIMIX_process_self(); + msg_process_t process = MSG_process_self(); // This is the jprocess passed as environment. // It would be simpler if we could use a closure. jobject jprocess = (jobject) MSG_process_get_data(process); diff --git a/src/msg/instr_msg_process.cpp b/src/msg/instr_msg_process.cpp index 6243a29f63..8bb5b20cce 100644 --- a/src/msg/instr_msg_process.cpp +++ b/src/msg/instr_msg_process.cpp @@ -12,7 +12,7 @@ XBT_LOG_NEW_DEFAULT_SUBCATEGORY (instr_msg_process, instr, "MSG process"); char *instr_process_id (msg_process_t proc, char *str, int len) { - return instr_process_id_2 (proc->name.c_str(), proc->pid, str, len);//MSG_process_get_name(proc), MSG_process_get_PID(proc), str, len); + return instr_process_id_2 (proc->cname(), proc->pid(), str, len); } char *instr_process_id_2 (const char *process_name, int process_pid, char *str, int len) @@ -82,7 +82,7 @@ void TRACE_msg_process_kill(smx_process_exit_status_t status, msg_process_t proc { if (TRACE_msg_process_is_enabled() && status==SMX_EXIT_FAILURE){ //kill means that this process no longer exists, let's destroy it - TRACE_msg_process_destroy(process->name.c_str(), process->pid); + TRACE_msg_process_destroy(process->cname(), process->pid()); } } diff --git a/src/msg/msg_gos.cpp b/src/msg/msg_gos.cpp index bab4a4d1ee..288732a375 100644 --- a/src/msg/msg_gos.cpp +++ b/src/msg/msg_gos.cpp @@ -269,7 +269,7 @@ msg_error_t MSG_task_receive_ext_bounded(msg_task_t * task, const char *alias, d /* Try to receive it by calling SIMIX network layer */ try { - simcall_comm_recv(MSG_process_self(), mailbox->getImpl(), task, nullptr, nullptr, nullptr, nullptr, timeout, rate); + simcall_comm_recv(MSG_process_self()->getImpl(), mailbox->getImpl(), task, nullptr, nullptr, nullptr, nullptr, timeout, rate); XBT_DEBUG("Got task %s from %s",(*task)->name,mailbox->name()); (*task)->simdata->setNotUsed(); } @@ -302,7 +302,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *al void *match_data, void_f_pvoid_t cleanup, int detached) { simdata_task_t t_simdata = nullptr; - msg_process_t myself = SIMIX_process_self(); + msg_process_t myself = MSG_process_self(); simgrid::s4u::MailboxPtr mailbox = simgrid::s4u::Mailbox::byName(alias); int call_end = TRACE_msg_task_put_start(task); @@ -315,7 +315,7 @@ static inline msg_comm_t MSG_task_isend_internal(msg_task_t task, const char *al msg_global->sent_msg++; /* Send it by calling SIMIX network layer */ - smx_activity_t act = simcall_comm_isend(myself, mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, + smx_activity_t act = simcall_comm_isend(myself->getImpl(), mailbox->getImpl(), t_simdata->bytes_amount, t_simdata->rate, task, sizeof(void *), match_fun, cleanup, nullptr, match_data,detached); t_simdata->comm = static_cast(act); @@ -469,7 +469,7 @@ msg_comm_t MSG_task_irecv_bounded(msg_task_t *task, const char *name, double rat comm->task_sent = nullptr; comm->task_received = task; comm->status = MSG_OK; - comm->s_comm = simcall_comm_irecv(MSG_process_self(), mbox->getImpl(), task, nullptr, nullptr, nullptr, nullptr, rate); + comm->s_comm = simcall_comm_irecv(SIMIX_process_self(), mbox->getImpl(), task, nullptr, nullptr, nullptr, nullptr, rate); return comm; } @@ -715,7 +715,7 @@ void MSG_comm_copy_data_from_SIMIX(smx_activity_t synchro, void* buff, size_t bu // notify the user callback if any if (msg_global->task_copy_callback) { msg_task_t task = static_cast(buff); - msg_global->task_copy_callback(task, comm->src_proc, comm->dst_proc); + msg_global->task_copy_callback(task, comm->src_proc->ciface(), comm->dst_proc->ciface()); } } diff --git a/src/msg/msg_host.cpp b/src/msg/msg_host.cpp index 3d68513d29..968ae5d882 100644 --- a/src/msg/msg_host.cpp +++ b/src/msg/msg_host.cpp @@ -7,6 +7,7 @@ #include "simgrid/s4u/host.hpp" #include "simgrid/s4u/storage.hpp" #include "src/msg/msg_private.h" +#include "src/simix/ActorImpl.hpp" XBT_LOG_EXTERNAL_DEFAULT_CATEGORY(msg); @@ -139,12 +140,16 @@ int MSG_host_get_core_number(msg_host_t host) { * \brief Return the list of processes attached to an host. * * \param host a host - * \return a swag with the attached processes + * \param whereto a dynar in which we should push processes living on that host */ -xbt_swag_t MSG_host_get_process_list(msg_host_t host) +void MSG_host_get_process_list(msg_host_t host, xbt_dynar_t whereto) { xbt_assert((host != nullptr), "Invalid parameters"); - return host->processes(); + smx_actor_t actor = NULL; + xbt_swag_foreach(actor, host->processes()) { + msg_process_t p = actor->ciface(); + xbt_dynar_push(whereto, &p); + } } /** \ingroup m_host_management diff --git a/src/msg/msg_process.cpp b/src/msg/msg_process.cpp index eeb371925e..cf9d6cc465 100644 --- a/src/msg/msg_process.cpp +++ b/src/msg/msg_process.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2004-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2004-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -55,7 +54,7 @@ smx_actor_t MSG_process_create_from_SIMIX(const char* name, std::functiongetImpl() : nullptr; } /** \ingroup m_process_management @@ -138,7 +137,7 @@ msg_process_t MSG_process_create_from_stdfunc(const char* name, std::functionciface(); } SG_BEGIN_DECL() @@ -163,12 +162,11 @@ msg_process_t MSG_process_attach(const char *name, void *data, msg_host_t host, xbt_assert(host != nullptr, "Invalid parameters: host and code params must not be nullptr"); /* Let's create the process: SIMIX may decide to start it right now, even before returning the flow control to us */ - msg_process_t process = - SIMIX_process_attach(name, new simgrid::MsgActorExt(data), host->cname(), properties, nullptr); + smx_actor_t process = SIMIX_process_attach(name, new simgrid::MsgActorExt(data), host->cname(), properties, nullptr); if (!process) xbt_die("Could not attach"); simcall_process_on_exit(process,(int_f_pvoid_pvoid_t)TRACE_msg_process_kill,process); - return process; + return process->ciface(); } /** Detach a process attached with `MSG_process_attach()` @@ -189,7 +187,7 @@ void MSG_process_detach() */ void MSG_process_kill(msg_process_t process) { - simcall_process_kill(process); + simcall_process_kill(process->getImpl()); } /** @@ -199,7 +197,7 @@ void MSG_process_kill(msg_process_t process) * \param timeout wait until the process is over, or the timeout occurs */ msg_error_t MSG_process_join(msg_process_t process, double timeout){ - simcall_process_join(process, timeout); + simcall_process_join(process->getImpl(), timeout); return MSG_OK; } @@ -212,7 +210,7 @@ msg_error_t MSG_process_join(msg_process_t process, double timeout){ msg_error_t MSG_process_migrate(msg_process_t process, msg_host_t host) { TRACE_msg_process_change_host(process, MSG_process_get_host(process), host); - simcall_process_set_host(process, host); + simcall_process_set_host(process->getImpl(), host); return MSG_OK; } @@ -232,7 +230,7 @@ void* MSG_process_get_data(msg_process_t process) xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); /* get from SIMIX the MSG process data, and then the user data */ - simgrid::MsgActorExt* msgExt = (simgrid::MsgActorExt*)process->data; + simgrid::MsgActorExt* msgExt = (simgrid::MsgActorExt*)process->getImpl()->data; if (msgExt) return msgExt->data; else @@ -248,7 +246,7 @@ msg_error_t MSG_process_set_data(msg_process_t process, void *data) { xbt_assert(process != nullptr, "Invalid parameter: first parameter must not be nullptr!"); - static_cast(process->data)->data = data; + static_cast(process->getImpl()->data)->data = data; return MSG_OK; } @@ -269,9 +267,9 @@ XBT_PUBLIC(void) MSG_process_set_data_cleanup(void_f_pvoid_t data_cleanup) { msg_host_t MSG_process_get_host(msg_process_t process) { if (process == nullptr) { - return MSG_process_self()->host; + return SIMIX_process_self()->host; } else { - return process->host; + return process->getImpl()->host; } } @@ -285,7 +283,7 @@ msg_host_t MSG_process_get_host(msg_process_t process) */ msg_process_t MSG_process_from_PID(int PID) { - return SIMIX_process_from_PID(PID); + return SIMIX_process_from_PID(PID)->ciface(); } /** @brief returns a list of all currently existing processes */ @@ -307,7 +305,7 @@ int MSG_process_get_number() */ msg_error_t MSG_process_set_kill_time(msg_process_t process, double kill_time) { - simcall_process_set_kill_time(process,kill_time); + simcall_process_set_kill_time(process->getImpl(), kill_time); return MSG_OK; } @@ -320,9 +318,9 @@ int MSG_process_get_PID(msg_process_t process) { /* Do not raise an exception here: this function is called by the logs * and the exceptions, so it would be called back again and again */ - if (process == nullptr) + if (process == nullptr || process->getImpl() == nullptr) return 0; - return process->pid; + return process->getImpl()->pid; } /** \ingroup m_process_management @@ -333,7 +331,7 @@ int MSG_process_get_PID(msg_process_t process) */ int MSG_process_get_PPID(msg_process_t process) { - return process->ppid; + return process->getImpl()->ppid; } /** \ingroup m_process_management @@ -343,7 +341,7 @@ int MSG_process_get_PPID(msg_process_t process) */ const char *MSG_process_get_name(msg_process_t process) { - return process->name.c_str(); + return process->cname(); } /** \ingroup m_process_management @@ -366,7 +364,7 @@ const char *MSG_process_get_property_value(msg_process_t process, const char *na xbt_dict_t MSG_process_get_properties(msg_process_t process) { xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr"); - return simcall_process_get_properties(process); + return simcall_process_get_properties(process->getImpl()); } /** \ingroup m_process_management @@ -376,7 +374,8 @@ xbt_dict_t MSG_process_get_properties(msg_process_t process) */ int MSG_process_self_PID() { - return MSG_process_get_PID(MSG_process_self()); + smx_actor_t self = SIMIX_process_self(); + return self == nullptr ? 0 : self->pid; } /** \ingroup m_process_management @@ -396,7 +395,7 @@ int MSG_process_self_PPID() */ msg_process_t MSG_process_self() { - return SIMIX_process_self(); + return SIMIX_process_self()->ciface(); } /** \ingroup m_process_management @@ -409,7 +408,7 @@ msg_error_t MSG_process_suspend(msg_process_t process) xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr"); TRACE_msg_process_suspend(process); - simcall_process_suspend(process); + simcall_process_suspend(process->getImpl()); return MSG_OK; } @@ -423,7 +422,7 @@ msg_error_t MSG_process_resume(msg_process_t process) xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr"); TRACE_msg_process_resume(process); - simcall_process_resume(process); + simcall_process_resume(process->getImpl()); return MSG_OK; } @@ -434,12 +433,11 @@ msg_error_t MSG_process_resume(msg_process_t process) */ int MSG_process_is_suspended(msg_process_t process) { - xbt_assert(process != nullptr, "Invalid parameter: First argument must not be nullptr"); - return simcall_process_is_suspended(process); + return simcall_process_is_suspended(process->getImpl()); } smx_context_t MSG_process_get_smx_ctx(msg_process_t process) { - return SIMIX_process_get_context(process); + return SIMIX_process_get_context(process->getImpl()); } /** * \ingroup m_process_management @@ -448,7 +446,7 @@ smx_context_t MSG_process_get_smx_ctx(msg_process_t process) { * You should use them to free the data used by your process. */ void MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void *data) { - simcall_process_on_exit(MSG_process_self(),fun,data); + simcall_process_on_exit(SIMIX_process_self(), fun, data); } /** * \ingroup m_process_management @@ -456,14 +454,14 @@ void MSG_process_on_exit(int_f_pvoid_pvoid_t fun, void *data) { * If the flag is set to 1, the process will be automatically restarted when its host comes back up. */ XBT_PUBLIC(void) MSG_process_auto_restart_set(msg_process_t process, int auto_restart) { - simcall_process_auto_restart_set(process,auto_restart); + simcall_process_auto_restart_set(process->getImpl(), auto_restart); } /** * \ingroup m_process_management * \brief Restarts a process from the beginning. */ XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) { - return simcall_process_restart(process); + return simcall_process_restart(process->getImpl())->ciface(); } /** @ingroup m_process_management @@ -472,7 +470,7 @@ XBT_PUBLIC(msg_process_t) MSG_process_restart(msg_process_t process) { XBT_PUBLIC(void) MSG_process_daemonize(msg_process_t process) { simgrid::simix::kernelImmediate([process]() { - process->daemonize(); + process->getImpl()->daemonize(); }); } diff --git a/src/s4u/s4u_actor.cpp b/src/s4u/s4u_actor.cpp index 426b85048c..f58240a8ce 100644 --- a/src/s4u/s4u_actor.cpp +++ b/src/s4u/s4u_actor.cpp @@ -87,7 +87,7 @@ double Actor::killTime() } void Actor::kill(int pid) { - msg_process_t process = SIMIX_process_from_PID(pid); + smx_actor_t process = SIMIX_process_from_PID(pid); if(process != nullptr) { simcall_process_kill(process); } else { diff --git a/src/simix/ActorImpl.hpp b/src/simix/ActorImpl.hpp index 8bab69bc34..71b48e014d 100644 --- a/src/simix/ActorImpl.hpp +++ b/src/simix/ActorImpl.hpp @@ -84,6 +84,7 @@ public: ~ActorImpl(); simgrid::s4u::ActorPtr iface() { return s4u::ActorPtr(&piface_); } + simgrid::s4u::Actor* ciface() { return &piface_; } void daemonize(); bool isDaemon(); diff --git a/teshsuite/msg/CMakeLists.txt b/teshsuite/msg/CMakeLists.txt index ba63986a32..24df2329ab 100644 --- a/teshsuite/msg/CMakeLists.txt +++ b/teshsuite/msg/CMakeLists.txt @@ -1,5 +1,6 @@ +# C examples foreach(x concurrent_rw get_sender host_on_off host_on_off_recv host_on_off_processes host_on_off_wait listen_async pid - process storage_client_server trace_integration) + storage_client_server trace_integration) add_executable (${x} ${x}/${x}.c) target_link_libraries(${x} simgrid) set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) @@ -8,7 +9,8 @@ foreach(x concurrent_rw get_sender host_on_off host_on_off_recv host_on_off_proc set(teshsuite_src ${teshsuite_src} ${CMAKE_CURRENT_SOURCE_DIR}/${x}/${x}.c) endforeach() -foreach(x task_destroy_cancel) +# CPP examples +foreach(x process task_destroy_cancel) add_executable (${x} ${x}/${x}.cpp) target_link_libraries(${x} simgrid) set_target_properties(${x} PROPERTIES RUNTIME_OUTPUT_DIRECTORY ${CMAKE_CURRENT_BINARY_DIR}/${x}) diff --git a/teshsuite/msg/host_on_off/host_on_off.c b/teshsuite/msg/host_on_off/host_on_off.c index fcb42c63a6..c7df9067a7 100644 --- a/teshsuite/msg/host_on_off/host_on_off.c +++ b/teshsuite/msg/host_on_off/host_on_off.c @@ -57,11 +57,15 @@ static int master(int argc, char *argv[]) MSG_task_destroy(task); MSG_host_on(jupiter); - xbt_swag_t jupi_processes = MSG_host_get_process_list(jupiter); - void *process; - xbt_swag_foreach(process, jupi_processes) { + + xbt_dynar_t jupi_processes = xbt_dynar_new(sizeof(msg_process_t), NULL); + MSG_host_get_process_list(jupiter, jupi_processes); + msg_process_t process = NULL; + unsigned int cursor; + xbt_dynar_foreach (jupi_processes, cursor, process) { MSG_process_kill(process); } + xbt_dynar_free(&jupi_processes); task = MSG_task_create("task on without proc", task_comp_size, task_comm_size, NULL); XBT_INFO("Sending \"%s\"", task->name); diff --git a/teshsuite/msg/pid/pid.c b/teshsuite/msg/pid/pid.c index 540aa6b1b8..ebe6b3afa1 100644 --- a/teshsuite/msg/pid/pid.c +++ b/teshsuite/msg/pid/pid.c @@ -43,10 +43,12 @@ static int killall(int argc, char *argv[]){ return 0; } -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { MSG_init(&argc, argv); + xbt_assert(argc >= 2, "Usage: pid platform pid_to_kill"); + MSG_process_killall(atoi(argv[2])); MSG_create_environment(argv[1]); diff --git a/teshsuite/msg/process/process.c b/teshsuite/msg/process/process.cpp similarity index 80% rename from teshsuite/msg/process/process.c rename to teshsuite/msg/process/process.cpp index 57a7fdbf15..bebb77d33f 100644 --- a/teshsuite/msg/process/process.c +++ b/teshsuite/msg/process/process.cpp @@ -1,5 +1,4 @@ -/* Copyright (c) 2010-2015. The SimGrid Team. - * All rights reserved. */ +/* Copyright (c) 2010-2017. The SimGrid Team. All rights reserved. */ /* This program is free software; you can redistribute it and/or modify it * under the terms of the license (GNU LGPL) which comes with this package. */ @@ -8,11 +7,11 @@ XBT_LOG_NEW_DEFAULT_CATEGORY(msg_test, "Messages specific for this msg example"); -static int slave(int argc, char *argv[]) +static int slave(int argc, char* argv[]) { MSG_process_sleep(.5); XBT_INFO("Slave started (PID:%d, PPID:%d)", MSG_process_self_PID(), MSG_process_self_PPID()); - while(1){ + while (1) { XBT_INFO("Plop i am %ssuspended", (MSG_process_is_suspended(MSG_process_self())) ? "" : "not "); MSG_process_sleep(1); } @@ -20,17 +19,22 @@ static int slave(int argc, char *argv[]) return 0; } -static int master(int argc, char *argv[]) +static int master(int argc, char* argv[]) { - xbt_swag_t process_list = MSG_host_get_process_list(MSG_host_self()); - msg_process_t process = NULL; MSG_process_sleep(1); - xbt_swag_foreach(process, process_list) { + xbt_dynar_t process_list = xbt_dynar_new(sizeof(msg_process_t), nullptr); + MSG_host_get_process_list(MSG_host_self(), process_list); + + msg_process_t process = NULL; + unsigned int cursor; + xbt_dynar_foreach (process_list, cursor, process) { XBT_INFO("Process(pid=%d, ppid=%d, name=%s)", MSG_process_get_PID(process), MSG_process_get_PPID(process), MSG_process_get_name(process)); if (MSG_process_self_PID() != MSG_process_get_PID(process)) MSG_process_kill(process); } + xbt_dynar_free(&process_list); + process = MSG_process_create("slave from master", slave, NULL, MSG_host_self()); MSG_process_sleep(2); @@ -53,10 +57,8 @@ static int master(int argc, char *argv[]) return 0; } -int main(int argc, char *argv[]) +int main(int argc, char* argv[]) { - msg_error_t res; - MSG_init(&argc, argv); xbt_assert(argc == 2, "Usage: %s platform_file\n\t Example: %s msg_platform.xml\n", argv[0], argv[0]); @@ -65,7 +67,7 @@ int main(int argc, char *argv[]) MSG_process_create("master", master, NULL, MSG_get_host_by_name("Tremblay")); MSG_process_create("slave", slave, NULL, MSG_get_host_by_name("Tremblay")); - res = MSG_main(); + msg_error_t res = MSG_main(); XBT_INFO("Simulation time %g", MSG_get_clock());