test/hotspot/gtest/utilities/test_singleWriterSynchronizer.cpp
author manc
Mon, 14 Oct 2019 18:48:10 -0700
changeset 58652 9b67dd88a931
parent 58095 adc72cd1d1f2
child 58679 9c3209ff7550
child 59247 56bf71d64d51
permissions -rw-r--r--
8232232: G1RemSetSummary::_rs_threads_vtimes is not initialized to zero Summary: Fix error in "Concurrent refinement threads times" in GC log and cleanup. Reviewed-by: tschatzl, kbarrett
Ignore whitespace changes - Everywhere: Within whitespace: At end of lines:
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     1
/*
58041
d8902e9c307c 8230422: Convert uninterruptible os::sleep calls to os::naked_short_sleep
dholmes
parents: 51690
diff changeset
     2
 * Copyright (c) 2018, 2019, Oracle and/or its affiliates. All rights reserved.
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     3
 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     4
 *
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     5
 * This code is free software; you can redistribute it and/or modify it
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     6
 * under the terms of the GNU General Public License version 2 only, as
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     7
 * published by the Free Software Foundation.
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     8
 *
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
     9
 * This code is distributed in the hope that it will be useful, but WITHOUT
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    10
 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    11
 * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    12
 * version 2 for more details (a copy is included in the LICENSE file that
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    13
 * accompanied this code).
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    14
 *
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    15
 * You should have received a copy of the GNU General Public License version
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    16
 * 2 along with this work; if not, write to the Free Software Foundation,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    17
 * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    18
 *
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    19
 * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    20
 * or visit www.oracle.com if you need additional information or have any
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    21
 * questions.
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    22
 *
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    23
 */
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    24
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    25
#include "precompiled.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    26
#include "runtime/interfaceSupport.inline.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    27
#include "runtime/orderAccess.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    28
#include "runtime/os.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    29
#include "runtime/thread.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    30
#include "utilities/debug.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    31
#include "utilities/globalCounter.inline.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    32
#include "utilities/globalDefinitions.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    33
#include "utilities/ostream.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    34
#include "utilities/singleWriterSynchronizer.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    35
#include "threadHelper.inline.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    36
#include "unittest.hpp"
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    37
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    38
class SingleWriterSynchronizerTestReader : public JavaTestThread {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    39
  SingleWriterSynchronizer* _synchronizer;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    40
  volatile uintx* _synchronized_value;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    41
  volatile int* _continue_running;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    42
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    43
  static const uint reader_iterations = 10;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    44
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    45
public:
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    46
  SingleWriterSynchronizerTestReader(Semaphore* post,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    47
                                     SingleWriterSynchronizer* synchronizer,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    48
                                     volatile uintx* synchronized_value,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    49
                                     volatile int* continue_running) :
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    50
    JavaTestThread(post),
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    51
    _synchronizer(synchronizer),
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    52
    _synchronized_value(synchronized_value),
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    53
    _continue_running(continue_running)
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    54
  {}
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    55
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    56
  virtual void main_run() {
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    57
    size_t iterations = 0;
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    58
    size_t values_changed = 0;
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    59
    while (OrderAccess::load_acquire(_continue_running) != 0) {
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    60
      { ThreadBlockInVM tbiv(this); } // Safepoint check outside critical section.
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    61
      ++iterations;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    62
      SingleWriterSynchronizer::CriticalSection cs(_synchronizer);
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    63
      uintx value = OrderAccess::load_acquire(_synchronized_value);
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    64
      uintx new_value = value;
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    65
      for (uint i = 0; i < reader_iterations; ++i) {
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    66
        new_value = OrderAccess::load_acquire(_synchronized_value);
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    67
        // A reader can see either the value it first read after
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    68
        // entering the critical section, or that value + 1.  No other
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    69
        // values are possible.
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    70
        if (value != new_value) {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    71
          ASSERT_EQ((value + 1), new_value);
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    72
        }
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    73
      }
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    74
      if (value != new_value) {
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    75
        ++values_changed;
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    76
      }
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    77
    }
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    78
    tty->print_cr("reader iterations: " SIZE_FORMAT ", changes: " SIZE_FORMAT,
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
    79
                  iterations, values_changed);
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    80
  }
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    81
};
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    82
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    83
class SingleWriterSynchronizerTestWriter : public JavaTestThread {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    84
  SingleWriterSynchronizer* _synchronizer;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    85
  volatile uintx* _synchronized_value;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    86
  volatile int* _continue_running;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    87
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    88
public:
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    89
  SingleWriterSynchronizerTestWriter(Semaphore* post,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    90
                                     SingleWriterSynchronizer* synchronizer,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    91
                                     volatile uintx* synchronized_value,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    92
                                     volatile int* continue_running) :
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    93
    JavaTestThread(post),
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    94
    _synchronizer(synchronizer),
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    95
    _synchronized_value(synchronized_value),
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    96
    _continue_running(continue_running)
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    97
  {}
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    98
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
    99
  virtual void main_run() {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   100
    while (OrderAccess::load_acquire(_continue_running) != 0) {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   101
      ++*_synchronized_value;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   102
      _synchronizer->synchronize();
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
   103
      { ThreadBlockInVM tbiv(this); } // Safepoint check.
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   104
    }
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   105
    tty->print_cr("writer iterations: " UINTX_FORMAT, *_synchronized_value);
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   106
  }
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   107
};
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   108
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   109
const uint nreaders = 5;
51690
b83571bbc147 8210511: TestSingleWriterSynchronizer can deadlock
kbarrett
parents: 51511
diff changeset
   110
const uint milliseconds_to_run = 1000;
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   111
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   112
TEST_VM(TestSingleWriterSynchronizer, stress) {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   113
  Semaphore post;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   114
  SingleWriterSynchronizer synchronizer;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   115
  volatile uintx synchronized_value = 0;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   116
  volatile int continue_running = 1;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   117
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   118
  JavaTestThread* readers[nreaders] = {};
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   119
  for (uint i = 0; i < nreaders; ++i) {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   120
    readers[i] = new SingleWriterSynchronizerTestReader(&post,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   121
                                                        &synchronizer,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   122
                                                        &synchronized_value,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   123
                                                        &continue_running);
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   124
    readers[i]->doit();
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   125
  }
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   126
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   127
  JavaTestThread* writer =
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   128
    new SingleWriterSynchronizerTestWriter(&post,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   129
                                           &synchronizer,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   130
                                           &synchronized_value,
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   131
                                           &continue_running);
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   132
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   133
  writer->doit();
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   134
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   135
  tty->print_cr("Stressing synchronizer for %u ms", milliseconds_to_run);
58041
d8902e9c307c 8230422: Convert uninterruptible os::sleep calls to os::naked_short_sleep
dholmes
parents: 51690
diff changeset
   136
  JavaThread* cur = JavaThread::current();
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   137
  {
58041
d8902e9c307c 8230422: Convert uninterruptible os::sleep calls to os::naked_short_sleep
dholmes
parents: 51690
diff changeset
   138
    ThreadInVMfromNative invm(cur);
58095
adc72cd1d1f2 8230423: Move os::sleep to JavaThread::sleep
dholmes
parents: 58041
diff changeset
   139
    cur->sleep(milliseconds_to_run);
51511
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   140
  }
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   141
  continue_running = 0;
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   142
  for (uint i = 0; i < nreaders + 1; ++i) {
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   143
    post.wait();
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   144
  }
eb8d5aeabab3 8209850: Allow NamedThreads to use GlobalCounter critical sections
kbarrett
parents:
diff changeset
   145
}