/** * Top-level runloop for workers, called by ForkJoinWorkerThread.run. */ final void runWorker(WorkQueue w) { w.growArray(); // allocate queue do { w.runTask(scan(w)); } while (w.qlock >= 0); }
/** * Top-level loop for worker threads: On each step: if the * previous step swept through all queues and found no tasks, or * there are excess threads, then possibly blocks. Otherwise, * scans for and, if found, executes a task. Returns when pool * and/or worker terminate. * * @param w the worker */ final void work(ForkJoinWorkerThread w) { boolean swept = false; // true on empty scans long c; while (!w.terminate && (int)(c = ctl) >= 0) { int a; // active count if (!swept && (a = (int)(c >> AC_SHIFT)) <= 0) swept = scan(w, a); else if (tryAwaitWork(w, c)) swept = false; } }
/** * Top-level loop for worker threads: On each step: if the * previous step swept through all queues and found no tasks, or * there are excess threads, then possibly blocks. Otherwise, * scans for and, if found, executes a task. Returns when pool * and/or worker terminate. * * @param w the worker */ final void work(ForkJoinWorkerThread w) { boolean swept = false; // true on empty scans long c; while (!w.terminate && (int)(c = ctl) >= 0) { int a; // active count if (!swept && (a = (int)(c >> AC_SHIFT)) <= 0) swept = scan(w, a); else if (tryAwaitWork(w, c)) swept = false; } }
/** * Top-level loop for worker threads: On each step: if the * previous step swept through all queues and found no tasks, or * there are excess threads, then possibly blocks. Otherwise, * scans for and, if found, executes a task. Returns when pool * and/or worker terminate. * * @param w the worker */ final void work(ForkJoinWorkerThread w) { boolean swept = false; // true on empty scans long c; while (!w.terminate && (int)(c = ctl) >= 0) { int a; // active count if (!swept && (a = (int)(c >> AC_SHIFT)) <= 0) swept = scan(w, a); else if (tryAwaitWork(w, c)) swept = false; } }
/** * Top-level runloop for workers, called by ForkJoinWorkerThread.run. */ final void runWorker(WorkQueue w) { w.growArray(); // allocate queue do { w.runTask(scan(w)); } while (w.qlock >= 0); }
/** * Top-level runloop for workers, called by ForkJoinWorkerThread.run. */ final void runWorker(WorkQueue w) { w.growArray(); // allocate queue do { w.runTask(scan(w)); } while (w.qlock >= 0); }
/** * Top-level runloop for workers, called by ForkJoinWorkerThread.run. */ final void runWorker(WorkQueue w) { w.growArray(); // allocate queue do { w.runTask(scan(w)); } while (w.qlock >= 0); }
/** * Top-level runloop for workers, called by ForkJoinWorkerThread.run. */ final void runWorker(WorkQueue w) { w.growArray(); // allocate queue do { w.runTask(scan(w)); } while (w.qlock >= 0); }
/** * Top-level runloop for workers, called by ForkJoinWorkerThread.run. */ final void runWorker(WorkQueue w) { w.growArray(); // allocate queue do { w.runTask(scan(w)); } while (w.qlock >= 0); }
/** * Top-level runloop for workers, called by ForkJoinWorkerThread.run. */ final void runWorker(WorkQueue w) { w.growArray(); // allocate queue do { w.runTask(scan(w)); } while (w.qlock >= 0); }
"ForkJoinPool.commonPool-worker-2@710" daemon prio=5 tid=0xe nid=NA runnable java.lang.Thread.State: RUNNABLE at java.util.stream.Stream$1.next(Stream.java:1033) at java.util.Spliterators$IteratorSpliterator.trySplit(Spliterators.java:1784) at java.util.stream.AbstractShortCircuitTask.compute(AbstractShortCircuitTask.java:114) at java.util.concurrent.CountedCompleter.exec(CountedCompleter.java:731) at java.util.concurrent.ForkJoinTask.doExec(ForkJoinTask.java:289) at java.util.concurrent.ForkJoinPool$WorkQueue.runTask(ForkJoinPool.java:902) at java.util.concurrent.ForkJoinPool.scan(ForkJoinPool.java:1689) at java.util.concurrent.ForkJoinPool.runWorker(ForkJoinPool.java:1644) at java.util.concurrent.ForkJoinWorkerThread.run(ForkJoinWorkerThread.java:157)`