< prev index next > src/java.base/share/classes/sun/nio/ch/NativeThreadSet.java
Print this page
/**
* Adds the current native thread to this set, returning its index so that
* it can efficiently be removed later.
*/
int add() {
! long th = NativeThread.currentNativeThread();
// 0 and -1 are treated as placeholders, not real thread handles
if (th == 0)
th = -1;
synchronized (this) {
int start = 0;
/**
* Adds the current native thread to this set, returning its index so that
* it can efficiently be removed later.
*/
int add() {
! long th = NativeThread.current();
// 0 and -1 are treated as placeholders, not real thread handles
if (th == 0)
th = -1;
synchronized (this) {
int start = 0;
/**
* Removes the thread at the give index.
*/
void remove(int i) {
synchronized (this) {
! assert (elts[i] == NativeThread.currentNativeThread()) || (elts[i] == -1);
elts[i] = 0;
used--;
if (used == 0 && waitingToEmpty)
notifyAll();
}
/**
* Removes the thread at the give index.
*/
void remove(int i) {
synchronized (this) {
! assert (elts[i] == NativeThread.current()) || (elts[i] == -1);
elts[i] = 0;
used--;
if (used == 0 && waitingToEmpty)
notifyAll();
}
< prev index next >