コード例 #1
0
ファイル: s4u-maestro-set.cpp プロジェクト: simgrid/simgrid
/** Main function */
int main(int argc, char* argv[])
{
  root_id = std::this_thread::get_id();

  SIMIX_set_maestro(maestro, NULL);
  simgrid::s4u::Engine e(&argc, argv);

  if (argc != 2) {
    XBT_CRITICAL("Usage: %s platform_file\n", argv[0]);
    xbt_die("example: %s msg_platform.xml\n", argv[0]);
  }

  e.load_platform(argv[1]);

  /* Become one of the simulated process.
   *
   * This must be done after the creation of the platform because we are depending attaching to a host.*/
  sg_actor_attach("sender", nullptr, simgrid::s4u::Host::by_name("Tremblay"), nullptr);
  ensure_root_tid();

  // Execute the sender code:
  sender();

  sg_actor_detach(); // Become root thread again
  XBT_INFO("Detached");
  ensure_root_tid();

  return 0;
}
コード例 #2
0
ファイル: maestro-set.cpp プロジェクト: fabienchaix/simgrid
/** Main function */
int main(int argc, char *argv[])
{
  root_id = std::this_thread::get_id();

  SIMIX_set_maestro(maestro, NULL);
  MSG_init(&argc, argv);

  if (argc != 2) {
    XBT_CRITICAL("Usage: %s platform_file\n", argv[0]);
    xbt_die("example: %s msg_platform.xml\n",argv[0]);
  }

  MSG_create_environment(argv[1]);

  /* Become one of the simulated process.
   *
   * This must be done after the creation of the platform because we are depending attaching to a host.*/
  MSG_process_attach("sender", NULL, MSG_host_by_name("Tremblay"), NULL);
  ensure_root_tid();

  // Execute the sender code:
  const char* subargv[3] = { "sender", "Jupiter", NULL };
  sender(2, (char**) subargv);

  MSG_process_detach(); // Become root thread again
  XBT_INFO("Detached");
  ensure_root_tid();

  return 0;
}