static volatile bool ping_pauseAll; static int ping_sleep = 100; // poll pauseAll flag every 100 ifndef LeanMode static volatile bool ping_anyActions; static Map ping_actions = newWeakHashMap(); endifndef // always returns true static bool ping() { if (ping_pauseAll ifndef LeanMode || ping_anyActions endifndef) ping_impl(); true; } // returns true when it slept static bool ping_impl() ctex { if (ping_pauseAll && !isAWTThread()) { do Thread.sleep(ping_sleep); while (ping_pauseAll); true; } ifndef LeanMode if (ping_anyActions) { O action; synchronized(ping_actions) { action = ping_actions.get(currentThread()); if (action instanceof Runnable) ping_actions.remove(currentThread()); if (ping_actions.isEmpty()) ping_anyActions = false; } if (action instanceof Runnable) ((Runnable) action).run(); else if (eq(action, "cancelled")) fail("Thread cancelled."); } endifndef ret false; }