< prev index next >

test/hotspot/gtest/utilities/test_globalCounter.cpp

Print this page




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "runtime/atomic.hpp"
  26 #include "runtime/orderAccess.hpp"
  27 #include "runtime/os.hpp"
  28 #include "utilities/globalCounter.hpp"
  29 #include "utilities/globalCounter.inline.hpp"
  30 #include "utilitiesHelper.inline.hpp"
  31 
  32 #define GOOD_VALUE 1337
  33 #define BAD_VALUE  4711
  34 
  35 struct TestData {
  36   long test_value;
  37 };
  38 
  39 class RCUReaderThread : public JavaTestThread {
  40 public:
  41   static volatile bool _exit;
  42   volatile TestData** _test;
  43   Semaphore* _wrt_start;
  44   RCUReaderThread(Semaphore* post, volatile TestData** test, Semaphore* wrt_start)
  45     : JavaTestThread(post), _test(test), _wrt_start(wrt_start) {};
  46   virtual ~RCUReaderThread(){}
  47   void main_run() {
  48     _wrt_start->signal();
  49     while (!_exit) {
  50       GlobalCounter::critical_section_begin(this);




  10  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  11  * FITNESS FOR A PARTICULAR PURPOSE.  See the GNU General Public License
  12  * version 2 for more details (a copy is included in the LICENSE file that
  13  * accompanied this code).
  14  *
  15  * You should have received a copy of the GNU General Public License version
  16  * 2 along with this work; if not, write to the Free Software Foundation,
  17  * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA.
  18  *
  19  * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA
  20  * or visit www.oracle.com if you need additional information or have any
  21  * questions.
  22  */
  23 
  24 #include "precompiled.hpp"
  25 #include "runtime/atomic.hpp"
  26 #include "runtime/orderAccess.hpp"
  27 #include "runtime/os.hpp"
  28 #include "utilities/globalCounter.hpp"
  29 #include "utilities/globalCounter.inline.hpp"
  30 #include "threadHelper.inline.hpp"
  31 
  32 #define GOOD_VALUE 1337
  33 #define BAD_VALUE  4711
  34 
  35 struct TestData {
  36   long test_value;
  37 };
  38 
  39 class RCUReaderThread : public JavaTestThread {
  40 public:
  41   static volatile bool _exit;
  42   volatile TestData** _test;
  43   Semaphore* _wrt_start;
  44   RCUReaderThread(Semaphore* post, volatile TestData** test, Semaphore* wrt_start)
  45     : JavaTestThread(post), _test(test), _wrt_start(wrt_start) {};
  46   virtual ~RCUReaderThread(){}
  47   void main_run() {
  48     _wrt_start->signal();
  49     while (!_exit) {
  50       GlobalCounter::critical_section_begin(this);


< prev index next >