|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||
java.lang.Objectcom.threerings.util.unsafe.Unsafe
public class Unsafe
A native library for doing unsafe things. Don't use this library. If you must ignore that warning, then be sure you use it sparingly and only in very well considered cases.
| Field Summary | |
|---|---|
protected static boolean |
_gcEnabled
The current state of GC enablement. |
protected static boolean |
_initialized
Whether or not we were able to initialize our library (i.e. get access to jvmpi) |
protected static boolean |
_loaded
Whether or not we were able to load our library. |
protected static Throwable |
_loadError
The error that occurred when loading the native library, or null if none occurred or it was already reported. |
| Constructor Summary | |
|---|---|
Unsafe()
|
|
| Method Summary | |
|---|---|
protected static void |
disableGC()
Disables garbage collection. |
protected static void |
enableGC()
Reenable garbage collection after a call to disableGC(). |
protected static boolean |
init()
Called to initialize our library. |
protected static boolean |
isLoaded()
Returns true if the native library was successfully loaded, and if this is the first time it's been checked and it failed, reports the failure. |
protected static boolean |
nativeSetegid(int gid)
Calls through to the native OS system call to change our egid. |
protected static boolean |
nativeSeteuid(int uid)
Calls through to the native OS system call to change our euid. |
protected static boolean |
nativeSetgid(int gid)
Calls through to the native OS system call to change our gid. |
protected static boolean |
nativeSetuid(int uid)
Calls through to the native OS system call to change our uid. |
protected static void |
nativeSleep(int millis)
Sleeps the current thread for the specified number of milliseconds. |
static boolean |
setegid(int gid)
Sets the process' effective gid to the specified value. |
static boolean |
seteuid(int uid)
Sets the process' effective uid to the specified value. |
static void |
setGCEnabled(boolean enabled)
Enables or disables garbage collection. |
static boolean |
setgid(int gid)
Sets the process' gid to the specified value. |
static boolean |
setuid(int uid)
Sets the process' uid to the specified value. |
static void |
sleep(int millis)
Causes the current thread to block for the specified number of milliseconds. |
| Methods inherited from class java.lang.Object |
|---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
| Field Detail |
|---|
protected static boolean _gcEnabled
protected static boolean _loaded
protected static boolean _initialized
protected static Throwable _loadError
| Constructor Detail |
|---|
public Unsafe()
| Method Detail |
|---|
public static void setGCEnabled(boolean enabled)
Calls to this method do not nest. Regardless of how many times you disable GC, only one call is required to reenable it.
public static void sleep(int millis)
Thread.sleep(long) is only accurate to around 12ms which
is wholly unacceptable.
public static boolean setuid(int uid)
public static boolean setgid(int gid)
public static boolean seteuid(int uid)
public static boolean setegid(int gid)
protected static boolean isLoaded()
protected static void enableGC()
disableGC().
protected static void disableGC()
protected static void nativeSleep(int millis)
protected static boolean nativeSetuid(int uid)
protected static boolean nativeSetgid(int gid)
protected static boolean nativeSeteuid(int uid)
protected static boolean nativeSetegid(int gid)
protected static boolean init()
|
|||||||||
| PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||
| SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD | ||||||||