private static Queue events = new Queue(50);
/** the number of objects in the queue that are not subclasses of ThreadMessage */
- private static volatile int nonThreadEventsInQueue = 0;
+ public static volatile int nonThreadEventsInQueue = 0;
/** the message currently being performed */
static Message currentlyPerforming = null;
public MessageQueueWatcher() { start(); }
public void run() {
while(true) {
- if (m != null && m == MessageQueue.currentlyPerforming) {
+ if ((m != null && m == MessageQueue.currentlyPerforming) || MessageQueue.working) {
Context cx;
String what;
- if (m instanceof ThreadMessage) {
+ if (m == null) {
+ cx = Context.getContextForThread(MessageQueue.singleton);
+ what = "trap";
+ } else if (m instanceof ThreadMessage) {
ThreadMessage tm = (ThreadMessage)m;
cx = Context.getContextForThread(tm);
what = "background thread";