/* * Copyright (c) 2019, Oracle and/or its affiliates. All rights reserved. * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. * * This code is free software; you can redistribute it and/or modify it * under the terms of the GNU General Public License version 2 only, as * published by the Free Software Foundation. * * This code is distributed in the hope that it will be useful, but WITHOUT * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License * version 2 for more details (a copy is included in the LICENSE file that * accompanied this code). * * You should have received a copy of the GNU General Public License version * 2 along with this work; if not, write to the Free Software Foundation, * Inc., 51 Franklin St, Fifth Floor, Boston, MA 02110-1301 USA. * * Please contact Oracle, 500 Oracle Parkway, Redwood Shores, CA 94065 USA * or visit www.oracle.com if you need additional information or have any * questions. *
*/
class Threads::Test::VM_TestClaimOverflow : public VM_GTestExecuteAtSafepoint { public: void doit() { // Prevent changes to the NJT list while we're conducting our test.
MutexLocker ml(NonJavaThreadsList_lock, Mutex::_no_safepoint_check_flag);
_thread_claim_token = max_uintx - 1;
ASSERT_EQ(max_uintx - 1, thread_claim_token());
CountThreads count1(thread_claim_token(), true);
threads_do(&count1);
tty->print_cr("Testing claim overflow with %u threads", count1.count()); // At least the main thread and the VM thread.
ASSERT_LE(2u, count1.count());
ASSERT_LE(1u, count1.java_threads_count());
ASSERT_LE(1u, count1.non_java_threads_count());
// Verify all threads have claim value of 0 after change overflow.
CheckClaims check3(0);
threads_do(&check3);
ASSERT_EQ(count1.count(), check3.claimed());
ASSERT_EQ(0u, check3.unclaimed());
}
};
// Test overflow handling in Threads::change_thread_claim_token().
TEST_VM(ThreadsTest, claim_overflow) {
Threads::Test::VM_TestClaimOverflow op;
ThreadInVMfromNative invm(JavaThread::current());
VMThread::execute(&op);
}
Die Informationen auf dieser Webseite wurden
nach bestem Wissen sorgfältig zusammengestellt. Es wird jedoch weder Vollständigkeit, noch Richtigkeit,
noch Qualität der bereit gestellten Informationen zugesichert.
Bemerkung:
Die farbliche Syntaxdarstellung und die Messung sind noch experimentell.