|
34 | 34 | #include "runtime/semaphore.hpp"
|
35 | 35 | #include "runtime/thread.inline.hpp"
|
36 | 36 |
|
37 |
| -static void run_foreground_task_if_needed(AbstractGangTask* task, uint num_workers, |
38 |
| - bool add_foreground_work) { |
39 |
| - if (add_foreground_work) { |
40 |
| - log_develop_trace(gc, workgang)("Running work gang: %s task: %s worker: foreground", |
41 |
| - Thread::current()->name(), task->name()); |
42 |
| - task->work(num_workers); |
43 |
| - log_develop_trace(gc, workgang)("Finished work gang: %s task: %s worker: foreground " |
44 |
| - "thread: " PTR_FORMAT, Thread::current()->name(), task->name(), p2i(Thread::current())); |
45 |
| - } |
46 |
| -} |
47 |
| - |
48 | 37 | // WorkGang dispatcher implemented with semaphores.
|
49 | 38 | //
|
50 | 39 | // Semaphores don't require the worker threads to re-claim the lock when they wake up.
|
@@ -79,16 +68,14 @@ class GangTaskDispatcher : public CHeapObj<mtGC> {
|
79 | 68 |
|
80 | 69 | // Distributes the task out to num_workers workers.
|
81 | 70 | // Returns when the task has been completed by all workers.
|
82 |
| - void coordinator_execute_on_workers(AbstractGangTask* task, uint num_workers, bool add_foreground_work) { |
| 71 | + void coordinator_execute_on_workers(AbstractGangTask* task, uint num_workers) { |
83 | 72 | // No workers are allowed to read the state variables until they have been signaled.
|
84 | 73 | _task = task;
|
85 | 74 | _not_finished = num_workers;
|
86 | 75 |
|
87 | 76 | // Dispatch 'num_workers' number of tasks.
|
88 | 77 | _start_semaphore->signal(num_workers);
|
89 | 78 |
|
90 |
| - run_foreground_task_if_needed(task, num_workers, add_foreground_work); |
91 |
| - |
92 | 79 | // Wait for the last worker to signal the coordinator.
|
93 | 80 | _end_semaphore->wait();
|
94 | 81 |
|
@@ -198,14 +185,14 @@ void WorkGang::run_task(AbstractGangTask* task) {
|
198 | 185 | run_task(task, active_workers());
|
199 | 186 | }
|
200 | 187 |
|
201 |
| -void WorkGang::run_task(AbstractGangTask* task, uint num_workers, bool add_foreground_work) { |
| 188 | +void WorkGang::run_task(AbstractGangTask* task, uint num_workers) { |
202 | 189 | guarantee(num_workers <= total_workers(),
|
203 | 190 | "Trying to execute task %s with %u workers which is more than the amount of total workers %u.",
|
204 | 191 | task->name(), num_workers, total_workers());
|
205 | 192 | guarantee(num_workers > 0, "Trying to execute task %s with zero workers", task->name());
|
206 | 193 | uint old_num_workers = _active_workers;
|
207 | 194 | update_active_workers(num_workers);
|
208 |
| - _dispatcher->coordinator_execute_on_workers(task, num_workers, add_foreground_work); |
| 195 | + _dispatcher->coordinator_execute_on_workers(task, num_workers); |
209 | 196 | update_active_workers(old_num_workers);
|
210 | 197 | }
|
211 | 198 |
|
|
0 commit comments