X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/d0ffc37686edcc803601f76ab51fdfed5fc2f241..39c935d6d5ee86d153f6f7e6a10d723ae7c57f6f:/src/bindings/java/org/simgrid/msg/Mutex.java?ds=sidebyside diff --git a/src/bindings/java/org/simgrid/msg/Mutex.java b/src/bindings/java/org/simgrid/msg/Mutex.java index 1b76bb8bb9..f3d9c4723f 100644 --- a/src/bindings/java/org/simgrid/msg/Mutex.java +++ b/src/bindings/java/org/simgrid/msg/Mutex.java @@ -1,38 +1,37 @@ -/* - * Copyright (c) 2012-2013. 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. - * - */ +/* Copyright (c) 2012-2021. 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. */ + package org.simgrid.msg; -/** A mutex implemented on top of SimGrid synchronization mechanisms. - * You can use it exactly the same way that you use the mutexes, - * but to handle the interactions between the processes within the simulation. +/** A mutex implemented on top of SimGrid synchronization mechanisms. + * You can use it exactly the same way that you use the mutexes, + * but to handle the interactions between the processes within the simulation. * + * Don't mix simgrid synchronization with Java native one, or it will deadlock! */ public class Mutex { private long bind; // The C object -- don't touch it - + public Mutex() { init(); } - protected void finalize() { - exit(); + + /** @deprecated (from Java9 onwards) */ + @Deprecated @Override + protected void finalize() throws Throwable { + nativeFinalize(); } - private native void exit(); + private native void nativeFinalize(); private native void init(); public native void acquire(); public native void release(); - - /** - * Class initializer, to initialize various JNI stuff - */ + + /** Class initializer, to initialize various JNI stuff */ public static native void nativeInit(); static { - Msg.nativeInit(); + org.simgrid.NativeLib.nativeInit(); nativeInit(); } }