/** Locks on the semaphore object until the provided timeout expires
* @exception TimeoutException if the timeout expired before
* the semaphore could be acquired.
+ * @param timeout the duration of the lock
*/
public native void acquire(double timeout) throws TimeoutException;
/** Locks on the semaphore object with no timeout
try {
acquire(-1);
} catch (TimeoutException e) {
- // This should not happen.
- assert(false);
+ e.printStackTrace(); // This should not happen.
+ assert false ;
}
}
/** Releases the semaphore object
/** Deletes this semaphore when the GC reclaims it */
@Override
- protected void finalize() {
- try {
- nativeFinalize();
- } catch (Throwable e) {
- e.printStackTrace();
- }
+ protected void finalize() throws Throwable {
+ nativeFinalize();
}
private native void nativeFinalize();
/**
*/
public static native void nativeInit();
static {
- Msg.nativeInit();
+ org.simgrid.NativeLib.nativeInit();
nativeInit();
}
}
\ No newline at end of file