Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
fix build
authorFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 12 Feb 2019 14:50:54 +0000 (15:50 +0100)
committerFrederic Suter <frederic.suter@cc.in2p3.fr>
Tue, 12 Feb 2019 14:50:54 +0000 (15:50 +0100)
src/bindings/java/jmsg_process.cpp
teshsuite/msg/host_on_off_processes/host_on_off_processes.cpp

index 2a90a8d..2976e12 100644 (file)
@@ -236,9 +236,10 @@ JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_sleep(JNIEnv *env, jclass cl
 
 JNIEXPORT void JNICALL Java_org_simgrid_msg_Process_waitFor(JNIEnv * env, jobject jprocess, jdouble jseconds)
 {
-  msg_error_t rv;
+  msg_error_t rv = MSG_OK;
   if (not simgrid::kernel::context::StopRequest::try_n_catch(
-          [&rv, &jseconds]() { rv = MSG_process_sleep((double)jseconds); })) {
+          [&jseconds]() { simgrid::s4u::this_actor::sleep_for((double)jseconds); })) {
+    rv = MSG_HOST_FAILURE;
     jxbt_throw_by_name(env, "org/simgrid/msg/ProcessKilledError", "Process killed");
   }
   if (env->ExceptionOccurred())
index 3f500b0..242697b 100644 (file)
@@ -46,8 +46,9 @@ static int commTX(int /*argc*/, char** /*argv*/)
   msg_task_t task = MSG_task_create("COMM", 0, 100000000, NULL);
   MSG_task_dsend(task, mailbox, task_cleanup_handler);
   // We should wait a bit (if not the process will end before the communication, hence an exception on the other side).
-  int res = MSG_process_sleep(30);
-  if (res == MSG_HOST_FAILURE) {
+  try {
+    MSG_process_sleep(30);
+  } catch (simgrid::HostFailureException& e) {
     XBT_INFO("The host has died ... as expected.");
   }
   XBT_INFO("  TX done");