()
| 855 | if (backgroundThread == null) { |
| 856 | backgroundThread = new CodenameOneThread(new Runnable() { |
| 857 | @Override |
| 858 | public void run() { |
| 859 | // using while true to avoid double lock optimization with synchronized block |
| 860 | while (true) { |
| 861 | Runnable nextTask = null; |
| 862 | synchronized (lock) { |
| 863 | if (!backgroundTasks.isEmpty()) { |
| 864 | nextTask = backgroundTasks.get(0); |
| 865 | } else { |
| 866 | backgroundThread = null; |
| 867 | return; |
| 868 | } |
| 869 | backgroundTasks.remove(0); |
| 870 | } |
| 871 | try { |
| 872 | executeBackgroundTaskRunnable(nextTask); |
| 873 | } catch (Throwable e) { |
| 874 | Log.e(e); |
| 875 | } |
| 876 | Util.sleep(10); |
| 877 | } |
| 878 | } |
| 879 | }, "Task Thread"); |
| 880 | backgroundThread.setPriority(Thread.MIN_PRIORITY + 1); |
| 881 | backgroundThread.start(); |
nothing calls this directly
no test coverage detected