Logo AND Algorithmique Numérique Distribuée

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