src/share/vm/utilities/taskqueue.cpp

changeset 1280
df6caf649ff7
parent 1014
0fbdb4381b99
child 1746
2a1472c30599
     1.1 --- a/src/share/vm/utilities/taskqueue.cpp	Fri Jul 10 16:01:20 2009 -0700
     1.2 +++ b/src/share/vm/utilities/taskqueue.cpp	Tue Jul 14 15:40:39 2009 -0700
     1.3 @@ -64,15 +64,18 @@
     1.4  }
     1.5  
     1.6  void ParallelTaskTerminator::yield() {
     1.7 +  assert(_offered_termination <= _n_threads, "Invariant");
     1.8    os::yield();
     1.9  }
    1.10  
    1.11  void ParallelTaskTerminator::sleep(uint millis) {
    1.12 +  assert(_offered_termination <= _n_threads, "Invariant");
    1.13    os::sleep(Thread::current(), millis, false);
    1.14  }
    1.15  
    1.16  bool
    1.17  ParallelTaskTerminator::offer_termination(TerminatorTerminator* terminator) {
    1.18 +  assert(_offered_termination < _n_threads, "Invariant");
    1.19    Atomic::inc(&_offered_termination);
    1.20  
    1.21    uint yield_count = 0;
    1.22 @@ -96,6 +99,7 @@
    1.23    // Loop waiting for all threads to offer termination or
    1.24    // more work.
    1.25    while (true) {
    1.26 +    assert(_offered_termination <= _n_threads, "Invariant");
    1.27      // Are all threads offering termination?
    1.28      if (_offered_termination == _n_threads) {
    1.29        return true;
    1.30 @@ -151,6 +155,7 @@
    1.31        if (peek_in_queue_set() ||
    1.32            (terminator != NULL && terminator->should_exit_termination())) {
    1.33          Atomic::dec(&_offered_termination);
    1.34 +        assert(_offered_termination < _n_threads, "Invariant");
    1.35          return false;
    1.36        }
    1.37      }

mercurial