src/share/vm/utilities/workgroup.hpp

changeset 6692
487f09bf44e0
parent 5103
f9be75d21404
child 6876
710a3c8b516e
     1.1 --- a/src/share/vm/utilities/workgroup.hpp	Thu Apr 17 18:47:15 2014 +0200
     1.2 +++ b/src/share/vm/utilities/workgroup.hpp	Wed May 14 13:32:44 2014 +0200
     1.3 @@ -359,18 +359,20 @@
     1.4  class WorkGangBarrierSync : public StackObj {
     1.5  protected:
     1.6    Monitor _monitor;
     1.7 -  uint     _n_workers;
     1.8 -  uint     _n_completed;
     1.9 +  uint    _n_workers;
    1.10 +  uint    _n_completed;
    1.11    bool    _should_reset;
    1.12 +  bool    _aborted;
    1.13  
    1.14    Monitor* monitor()        { return &_monitor; }
    1.15    uint     n_workers()      { return _n_workers; }
    1.16    uint     n_completed()    { return _n_completed; }
    1.17    bool     should_reset()   { return _should_reset; }
    1.18 +  bool     aborted()        { return _aborted; }
    1.19  
    1.20    void     zero_completed() { _n_completed = 0; }
    1.21    void     inc_completed()  { _n_completed++; }
    1.22 -
    1.23 +  void     set_aborted()    { _aborted = true; }
    1.24    void     set_should_reset(bool v) { _should_reset = v; }
    1.25  
    1.26  public:
    1.27 @@ -383,8 +385,14 @@
    1.28  
    1.29    // Enter the barrier. A worker that enters the barrier will
    1.30    // not be allowed to leave until all other threads have
    1.31 -  // also entered the barrier.
    1.32 -  void enter();
    1.33 +  // also entered the barrier or the barrier is aborted.
    1.34 +  // Returns false if the barrier was aborted.
    1.35 +  bool enter();
    1.36 +
    1.37 +  // Aborts the barrier and wakes up any threads waiting for
    1.38 +  // the barrier to complete. The barrier will remain in the
    1.39 +  // aborted state until the next call to set_n_workers().
    1.40 +  void abort();
    1.41  };
    1.42  
    1.43  // A class to manage claiming of subtasks within a group of tasks.  The

mercurial