< prev index next >

src/share/vm/utilities/workgroup.hpp

Print this page




 323                    bool  are_ConcurrentGC_threads) :
 324     WorkGang(name, workers, are_GC_task_threads, are_ConcurrentGC_threads),
 325     _active_workers(UseDynamicNumberOfGCThreads ? 1U : ParallelGCThreads) {}
 326   // Accessors for fields
 327   virtual uint active_workers() const { return _active_workers; }
 328   void set_active_workers(uint v) {
 329     assert(v <= _total_workers,
 330            "Trying to set more workers active than there are");
 331     _active_workers = MIN2(v, _total_workers);
 332     assert(v != 0, "Trying to set active workers to 0");
 333     _active_workers = MAX2(1U, _active_workers);
 334     assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
 335            "Unless dynamic should use total workers");
 336   }
 337   virtual void run_task(AbstractGangTask* task);
 338   virtual bool needs_more_workers() const {
 339     return _started_workers < _active_workers;
 340   }
 341 };
 342 
 343 // Work gangs in garbage collectors: 2009-06-10
 344 //
 345 // SharedHeap - work gang for stop-the-world parallel collection.
 346 //   Used by
 347 //     ParNewGeneration
 348 //     CMSParRemarkTask
 349 //     CMSRefProcTaskExecutor
 350 //     G1CollectedHeap
 351 //     G1ParFinalCountTask
 352 // ConcurrentMark
 353 // CMSCollector
 354 
 355 // A class that acts as a synchronisation barrier. Workers enter
 356 // the barrier and must wait until all other workers have entered
 357 // before any of them may leave.
 358 
 359 class WorkGangBarrierSync : public StackObj {
 360 protected:
 361   Monitor _monitor;
 362   uint    _n_workers;
 363   uint    _n_completed;
 364   bool    _should_reset;
 365   bool    _aborted;
 366 
 367   Monitor* monitor()        { return &_monitor; }
 368   uint     n_workers()      { return _n_workers; }
 369   uint     n_completed()    { return _n_completed; }
 370   bool     should_reset()   { return _should_reset; }
 371   bool     aborted()        { return _aborted; }
 372 
 373   void     zero_completed() { _n_completed = 0; }
 374   void     inc_completed()  { _n_completed++; }




 323                    bool  are_ConcurrentGC_threads) :
 324     WorkGang(name, workers, are_GC_task_threads, are_ConcurrentGC_threads),
 325     _active_workers(UseDynamicNumberOfGCThreads ? 1U : ParallelGCThreads) {}
 326   // Accessors for fields
 327   virtual uint active_workers() const { return _active_workers; }
 328   void set_active_workers(uint v) {
 329     assert(v <= _total_workers,
 330            "Trying to set more workers active than there are");
 331     _active_workers = MIN2(v, _total_workers);
 332     assert(v != 0, "Trying to set active workers to 0");
 333     _active_workers = MAX2(1U, _active_workers);
 334     assert(UseDynamicNumberOfGCThreads || _active_workers == _total_workers,
 335            "Unless dynamic should use total workers");
 336   }
 337   virtual void run_task(AbstractGangTask* task);
 338   virtual bool needs_more_workers() const {
 339     return _started_workers < _active_workers;
 340   }
 341 };
 342 












 343 // A class that acts as a synchronisation barrier. Workers enter
 344 // the barrier and must wait until all other workers have entered
 345 // before any of them may leave.
 346 
 347 class WorkGangBarrierSync : public StackObj {
 348 protected:
 349   Monitor _monitor;
 350   uint    _n_workers;
 351   uint    _n_completed;
 352   bool    _should_reset;
 353   bool    _aborted;
 354 
 355   Monitor* monitor()        { return &_monitor; }
 356   uint     n_workers()      { return _n_workers; }
 357   uint     n_completed()    { return _n_completed; }
 358   bool     should_reset()   { return _should_reset; }
 359   bool     aborted()        { return _aborted; }
 360 
 361   void     zero_completed() { _n_completed = 0; }
 362   void     inc_completed()  { _n_completed++; }


< prev index next >