< prev index next >

src/hotspot/share/gc/shared/workgroup.hpp

Print this page

        

*** 50,59 **** --- 50,60 ---- class AbstractGangWorker; class Semaphore; class ThreadClosure; class WorkGang; + class GangTaskDispatcher; // An abstract task to be worked on by a gang. // You subclass this to supply your own work() method class AbstractGangTask { const char* _name;
*** 78,110 **** AbstractGangTask* _task; uint _worker_id; WorkData(AbstractGangTask* task, uint worker_id) : _task(task), _worker_id(worker_id) {} }; - // Interface to handle the synchronization between the coordinator thread and the worker threads, - // when a task is dispatched out to the worker threads. - class GangTaskDispatcher : public CHeapObj<mtGC> { - public: - virtual ~GangTaskDispatcher() {} - - // Coordinator API. - - // Distributes the task out to num_workers workers. - // Returns when the task has been completed by all workers. - virtual void coordinator_execute_on_workers(AbstractGangTask* task, uint num_workers, - bool add_foreground_work) = 0; - - // Worker API. - - // Waits for a task to become available to the worker. - // Returns when the worker has been assigned a task. - virtual WorkData worker_wait_for_task() = 0; - - // Signal to the coordinator that the worker is done with the assigned task. - virtual void worker_done_with_task() = 0; - }; - // The work gang is the collection of workers to execute tasks. // The number of workers run for a task is "_active_workers" // while "_total_workers" is the number of available of workers. class AbstractWorkGang : public CHeapObj<mtInternal> { protected: --- 79,88 ----
< prev index next >