vmthreadqueueentry.java
来自「纯java操作系统jnode,安装简单和操作简单的个人使用的Java操作系统」· Java 代码 · 共 95 行
JAVA
95 行
/*
* $Id: VmThreadQueueEntry.java,v 1.1 2003/11/25 11:41:17 epr Exp $
*/
package org.jnode.vm;
/**
* Queue entry for VmThread's.
*
* This class is not synchronized, but protected by PragmaUninterruptible's,
* since it is used by the scheduler itself.
*
* @author Ewout Prangsma (epr@users.sourceforge.net)
*/
final class VmThreadQueueEntry extends VmSystemObject {
protected VmThreadQueueEntry next;
private VmThreadQueue inUseByQueue;
protected final VmThread thread;
private String lastCaller;
/**
* Initialize this instance
* @param thread
*/
public VmThreadQueueEntry(VmThread thread) {
this.thread = thread;
}
/**
* Gets the next entry
* @return next entry
* @throws PragmaUninterruptible
*/
final VmThreadQueueEntry getNext()
throws PragmaUninterruptible {
return next;
}
/**
* Is this entry used on any queue.
* @return boolean
* @throws PragmaUninterruptible
*/
final boolean isInUse()
throws PragmaUninterruptible {
return (inUseByQueue != null);
}
/**
* @param q
* @param caller
* @throws PragmaUninterruptible
*/
final void setInUse(VmThreadQueue q, String caller)
throws PragmaUninterruptible {
if (this.inUseByQueue != null) {
// currently in use
if (q == null) {
this.inUseByQueue = null;
} else if (q == this.inUseByQueue) {
throw new RuntimeException("Thread (" + thread + ") is already on the " + this.inUseByQueue.name + " queue by " + lastCaller);
} else {
throw new RuntimeException("Thread (" + thread + ") is already in use in another queue: " + this.inUseByQueue.name + "by " + lastCaller + ", cannot add to " + q.name);
}
} else {
// currently NOT in use
if (q == null) {
throw new RuntimeException("Thread (" + thread + ") is not in use");
} else {
this.inUseByQueue = q;
this.lastCaller = caller;
}
}
}
/**
* @param entry
* @throws PragmaUninterruptible
*/
final void setNext(VmThreadQueueEntry entry)
throws PragmaUninterruptible {
this.next = entry;
}
/**
* Gets the thread of this entry
* @return The thread
* @throws PragmaUninterruptible
*/
final VmThread getThread()
throws PragmaUninterruptible {
return thread;
}
}
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?