Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Fix silly bug in msg process sleep bindings - Adrien
[simgrid.git] / src / bindings / java / jmsg_synchro.c
index 21c04d7..cea6030 100644 (file)
@@ -5,6 +5,7 @@
 /* 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.    */
 
+#include "jmsg.h"
 #include "xbt/synchro_core.h"
 #include "jmsg_synchro.h"
 #include "jxbt_utilities.h"
@@ -80,8 +81,11 @@ Java_org_simgrid_msg_Semaphore_acquire(JNIEnv * env, jobject obj, jdouble timeou
 
   sem = (msg_sem_t) (long) (*env)->GetLongField(env, obj, jsyncro_field_Semaphore_bind);
   msg_error_t res = MSG_sem_acquire_timeout(sem, (double) timeout);
-  jmsg_throw_status(env, res);
+  if (res != MSG_OK) {
+    jmsg_throw_status(env, res);
+  }
 }
+
 JNIEXPORT void JNICALL
 Java_org_simgrid_msg_Semaphore_release(JNIEnv * env, jobject obj) {
   msg_sem_t sem;