| 796 | /// - `r`: @param r runnable (NOT A THREAD!) that will be invoked on the EDT serial to |
| 797 | /// the paint and key handling events |
| 798 | public void callSerially(Runnable r) { |
| 799 | // otherwise this will fail in an odd locaiton. Better it fails here... |
| 800 | if (r == null) { |
| 801 | throw new NullPointerException(); |
| 802 | } |
| 803 | if (codenameOneRunning) { |
| 804 | synchronized (lock) { |
| 805 | scheduleSerialCall(isEnableAsyncStackTraces() ? new DebugRunnable(r) : r); |
| 806 | lock.notifyAll(); |
| 807 | } |
| 808 | } else { |
| 809 | r.run(); |
| 810 | } |
| 811 | } |
| 812 | |
| 813 | // We factor out the scheduling of a serial call so that we can |
| 814 | // use the Schedule annotation for IntelliJ async debugging https://www.jetbrains.com/help/idea/debug-asynchronous-code.html |