Package com.avpkit.ferry
Class Mutex
- java.lang.Object
-
- com.avpkit.ferry.RefCounted
-
- com.avpkit.ferry.Mutex
-
public class Mutex extends RefCounted
Internal Only.
This object exists so that Native code can get access to
thread safe locking objects if they need it.
Implements a blocking Mutually-Exclusive lock
by wrapping a Java lock.
If not running inside Java, lock() and unlock()
are NO-OPs.
-
-
Field Summary
-
Fields inherited from class com.avpkit.ferry.RefCounted
swigCMemOwn
-
-
Method Summary
All Methods Static Methods Instance Methods Concrete Methods Modifier and Type Method Description MutexcopyReference()Create a new Mutex object that is actually referring to the exact same underlying native object.booleanequals(java.lang.Object obj)Compares two values, returning true if the underlying objects in native code are the same object.static longgetCPtr(Mutex obj)Internal Only.longgetMyCPtr()Internal Only.inthashCode()Get a hashable value for this object.voidlock()static Mutexmake()voidunlock()-
Methods inherited from class com.avpkit.ferry.RefCounted
acquire, delete, getCPtr, getCurrentRefCount, getJavaRefCount, release
-
-
-
-
Method Detail
-
getCPtr
public static long getCPtr(Mutex obj)
Internal Only. Not part of public API. Get the raw value of the native object that obj is proxying for.- Parameters:
obj- The java proxy object for a native object.- Returns:
- The raw pointer obj is proxying for.
-
getMyCPtr
public long getMyCPtr()
Internal Only. Not part of public API. Get the raw value of the native object that we're proxying for.- Overrides:
getMyCPtrin classRefCounted- Returns:
- The raw pointer we're proxying for.
-
copyReference
public Mutex copyReference()
Create a new Mutex object that is actually referring to the exact same underlying native object.- Overrides:
copyReferencein classRefCounted- Returns:
- the new Java object.
-
equals
public boolean equals(java.lang.Object obj)
Compares two values, returning true if the underlying objects in native code are the same object. That means you can have two different Java objects, but when you do a comparison, you'll find out they are the EXACT same object.- Overrides:
equalsin classjava.lang.Object- Returns:
- True if the underlying native object is the same. False otherwise.
-
hashCode
public int hashCode()
Get a hashable value for this object.- Overrides:
hashCodein classjava.lang.Object- Returns:
- the hashable value.
-
lock
public void lock()
-
unlock
public void unlock()
-
-