X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/97833d16834563a8e1773e4f8ff364a80bcb6c6a..f3e4803befab19389587dd1d9af5ecdeffec551e:/src/bindings/java/jmsg_synchro.c diff --git a/src/bindings/java/jmsg_synchro.c b/src/bindings/java/jmsg_synchro.c index 21c04d7a6d..feaeac1ea9 100644 --- a/src/bindings/java/jmsg_synchro.c +++ b/src/bindings/java/jmsg_synchro.c @@ -1,10 +1,12 @@ /* Functions exporting the simgrid synchronization mechanisms to the Java world */ -/* Copyright (c) 2012. The SimGrid Team. All rights reserved. */ +/* Copyright (c) 2012-2014. 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. */ + * 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" @@ -50,7 +52,7 @@ Java_org_simgrid_msg_Mutex_release(JNIEnv * env, jobject obj) { } JNIEXPORT void JNICALL -Java_org_simgrid_msg_Mutex_exit(JNIEnv * env, jobject obj) { +Java_org_simgrid_msg_Mutex_nativeFinalize(JNIEnv * env, jobject obj) { xbt_mutex_t mutex; mutex = (xbt_mutex_t) (long) (*env)->GetLongField(env, obj, jsyncro_field_Mutex_bind); @@ -80,8 +82,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; @@ -99,7 +104,7 @@ Java_org_simgrid_msg_Semaphore_wouldBlock(JNIEnv * env, jobject obj) { } JNIEXPORT void JNICALL -Java_org_simgrid_msg_Mutex_destroy(JNIEnv * env, jobject obj) { +Java_org_simgrid_msg_Semaphore_nativeFinalize(JNIEnv * env, jobject obj) { msg_sem_t sem; sem = (msg_sem_t) (long) (*env)->GetLongField(env, obj, jsyncro_field_Semaphore_bind);