equal
deleted
inserted
replaced
57 public: |
57 public: |
58 // The abstract work method. |
58 // The abstract work method. |
59 // The argument tells you which member of the gang you are. |
59 // The argument tells you which member of the gang you are. |
60 virtual void work(uint worker_id) = 0; |
60 virtual void work(uint worker_id) = 0; |
61 |
61 |
62 // This method configures the task for proper termination. |
|
63 // Some tasks do not have any requirements on termination |
|
64 // and may inherit this method that does nothing. Some |
|
65 // tasks do some coordination on termination and override |
|
66 // this method to implement that coordination. |
|
67 virtual void set_for_termination(uint active_workers) {}; |
|
68 |
|
69 // Debugging accessor for the name. |
62 // Debugging accessor for the name. |
70 const char* name() const PRODUCT_RETURN_(return NULL;); |
63 const char* name() const PRODUCT_RETURN_(return NULL;); |
71 int counter() { return _counter; } |
64 int counter() { return _counter; } |
72 void set_counter(int value) { _counter = value; } |
65 void set_counter(int value) { _counter = value; } |
73 int *address_of_counter() { return &_counter; } |
66 int *address_of_counter() { return &_counter; } |
97 |
90 |
98 class AbstractGangTaskWOopQueues : public AbstractGangTask { |
91 class AbstractGangTaskWOopQueues : public AbstractGangTask { |
99 OopTaskQueueSet* _queues; |
92 OopTaskQueueSet* _queues; |
100 ParallelTaskTerminator _terminator; |
93 ParallelTaskTerminator _terminator; |
101 public: |
94 public: |
102 AbstractGangTaskWOopQueues(const char* name, OopTaskQueueSet* queues) : |
95 AbstractGangTaskWOopQueues(const char* name, OopTaskQueueSet* queues, uint n_threads) : |
103 AbstractGangTask(name), _queues(queues), _terminator(0, _queues) {} |
96 AbstractGangTask(name), _queues(queues), _terminator(n_threads, _queues) {} |
104 ParallelTaskTerminator* terminator() { return &_terminator; } |
97 ParallelTaskTerminator* terminator() { return &_terminator; } |
105 virtual void set_for_termination(uint active_workers) { |
|
106 terminator()->reset_for_reuse(active_workers); |
|
107 } |
|
108 OopTaskQueueSet* queues() { return _queues; } |
98 OopTaskQueueSet* queues() { return _queues; } |
109 }; |
99 }; |
110 |
100 |
111 |
101 |
112 // Class AbstractWorkGang: |
102 // Class AbstractWorkGang: |