/** * Unblock the thread waiting for the given monitor * and cease execution on the current thread. * @param monitor The monitor to notify. */ public void unblock(Object monitor, boolean kill) { if(Thread.currentThread()!=componentthread) { throw new RuntimeException("Can only unblock current component thread: "+componentthread+", "+Thread.currentThread()); } Executor exe = blocked.remove(monitor); if(blocked.isEmpty()) { blocked = null; } // Throw thread death if component already has been terminated. Throwable t = kill ? new StepAborted() : null; exe.switchThread(monitor, t); }
/** * Unblock the thread waiting for the given monitor * and cease execution on the current thread. * @param monitor The monitor to notify. */ public void unblock(Object monitor, Throwable exception) { if(!isComponentThread()) { throw new RuntimeException("Can only unblock from component thread: "+componentthread+", "+Thread.currentThread()); } if(parenta!=null) { parenta.unblock(monitor, exception); } else { // System.out.println("unblock: "+monitor); Executor exe = blocked.remove(monitor); if(blocked.isEmpty()) { blocked = null; } exe.switchThread(monitor, exception); } }