final class GIL
extends java.lang.Object
GIL keeps locks for Threads running native code. Only one Thread can usually
be running C code at a time.| Modifier and Type | Field and Description |
|---|---|
private static java.util.concurrent.locks.ReentrantLock |
lock |
| Modifier | Constructor and Description |
|---|---|
private |
GIL() |
| Modifier and Type | Method and Description |
|---|---|
static void |
acquire() |
static void |
acquire(int lockCount)
Acquire the lock n-times.
|
static void |
release()
Decrease the lock holding count by one, and do a
GC run if this is
the last lock held by this thread. |
static int |
releaseAllLocks()
Release all locks currently held by this thread.
|
static void |
releaseNoCleanup()
Fast unlocking without GC.
|
public static void acquire()
public static void acquire(int lockCount)
JRuby.nativeBlockingRegion(org.jruby.Ruby, long, long, long, long).
After finishing execution of unmanaged code, the executing thread has to re-acquire all previously
owned locks (for cases where the execution of the Thread went through Java->C->Java->C multiple times)public static void release()
GC run if this is
the last lock held by this thread.public static void releaseNoCleanup()
public static int releaseAllLocks()