Logo AND Algorithmique Numérique Distribuée

Public GIT Repository
Merge branch 'master' of git+ssh://scm.gforge.inria.fr//gitroot/simgrid/simgrid
[simgrid.git] / src / bindings / java / org / simgrid / msg / Mutex.java
1 /* 
2  * Copyright (c) 2012-2013. The SimGrid Team.
3  * All rights reserved.
4  *
5  * This program is free software; you can redistribute 
6  * it and/or modify it under the terms of the license 
7  * (GNU LGPL) which comes with this package.
8  *
9  */
10 package org.simgrid.msg;
11 /** A mutex  implemented on top of SimGrid synchronization mechanisms. 
12  * You can use it exactly the same way that you use the mutexes, 
13  * but to handle the interactions between the processes within the simulation.   
14  *
15  */
16 public class Mutex {
17         private long bind; // The C object -- don't touch it
18         
19         public Mutex() {
20                 init();
21         }
22         protected void finalize() {
23                 exit();
24         }
25         private native void exit();
26         private native void init();
27         public native void acquire();
28         public native void release();
29         
30         /**
31          * Class initializer, to initialize various JNI stuff
32          */
33         public static native void nativeInit();
34         static {
35                 Msg.nativeInit();
36                 nativeInit();
37         }       
38 }
39
40