示例#1
0
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) {
        XBT_INFO("Plop i am %ssuspended", (MSG_process_is_suspended(MSG_process_self())) ? "" : "not ");
        MSG_process_sleep(1);
    }
    XBT_INFO("I'm done. See you!");
    return 0;
}
示例#2
0
JNIEXPORT jboolean JNICALL
Java_org_simgrid_msg_Process_isSuspended(JNIEnv * env,
                                         jobject jprocess)
{
  msg_process_t process = jprocess_to_native_process(jprocess, env);

  if (!process) {
    jxbt_throw_notbound(env, "process", jprocess);
    return 0;
  }

  /* true is the process is suspended, false otherwise */
  return (jboolean) MSG_process_is_suspended(process);
}
示例#3
0
    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);
  }
  process = MSG_process_create("slave from master",
                               slave, NULL, MSG_host_self());
  MSG_process_sleep(2);

  XBT_INFO("Suspend Process(pid=%d)", MSG_process_get_PID(process));
  MSG_process_suspend(process);

  XBT_INFO("Process(pid=%d) is %ssuspended",
           MSG_process_get_PID(process),
           (MSG_process_is_suspended(process)) ? "" : "not ");
  MSG_process_sleep(2);

  XBT_INFO("Resume Process(pid=%d)", MSG_process_get_PID(process));
  MSG_process_resume(process);

  XBT_INFO("Process(pid=%d) is %ssuspended",
           MSG_process_get_PID(process),
           (MSG_process_is_suspended(process)) ? "" : "not ");
  MSG_process_sleep(2);
  MSG_process_kill(process);

  XBT_INFO("Goodbye now!");
  return 0;
}                               /* end_of_master */