< prev index next >
test/hotspot/gtest/threadHelper.inline.hpp
Print this page
*** 46,68 ****
// This class and thread keep the non-safepoint op running while we do our testing.
class VMThreadBlocker : public JavaThread {
public:
Semaphore _ready;
Semaphore _unblock;
! VMThreadBlocker() {}
virtual ~VMThreadBlocker() {}
void run() {
this->set_thread_state(_thread_in_vm);
{
MutexLocker ml(Threads_lock);
Threads::add(this);
}
VM_StopSafepoint ss(&_ready, &_unblock);
VMThread::execute(&ss);
Threads::remove(this);
this->smr_delete();
}
void doit() {
if (os::create_thread(this, os::os_thread)) {
os::start_thread(this);
} else {
ASSERT_TRUE(false);
--- 46,77 ----
// This class and thread keep the non-safepoint op running while we do our testing.
class VMThreadBlocker : public JavaThread {
public:
Semaphore _ready;
Semaphore _unblock;
! VMThreadBlocker() { }
virtual ~VMThreadBlocker() {}
+ const char* get_thread_name_string(char* buf, int buflen) const {
+ return (char*) "VMThreadBlocker";
+ }
void run() {
this->set_thread_state(_thread_in_vm);
{
MutexLocker ml(Threads_lock);
Threads::add(this);
}
VM_StopSafepoint ss(&_ready, &_unblock);
VMThread::execute(&ss);
+ }
+
+ // Override as JavaThread::post_run() calls JavaThread::exit which
+ // expects a valid thread object oop.
+ virtual void post_run() {
Threads::remove(this);
this->smr_delete();
}
+
void doit() {
if (os::create_thread(this, os::os_thread)) {
os::start_thread(this);
} else {
ASSERT_TRUE(false);
*** 83,93 ****
JavaTestThread(Semaphore* post)
: _post(post) {
}
virtual ~JavaTestThread() {}
! void prerun() {
this->set_thread_state(_thread_in_vm);
{
MutexLocker ml(Threads_lock);
Threads::add(this);
}
--- 92,106 ----
JavaTestThread(Semaphore* post)
: _post(post) {
}
virtual ~JavaTestThread() {}
! const char* get_thread_name_string(char* buf, int buflen) const {
! return (char*) "JavaTestThread";
! }
!
! void pre_run() {
this->set_thread_state(_thread_in_vm);
{
MutexLocker ml(Threads_lock);
Threads::add(this);
}
*** 97,112 ****
}
virtual void main_run() = 0;
void run() {
- prerun();
main_run();
- postrun();
}
! void postrun() {
Threads::remove(this);
_post->signal();
this->smr_delete();
}
--- 110,125 ----
}
virtual void main_run() = 0;
void run() {
main_run();
}
! // Override as JavaThread::post_run() calls JavaThread::exit which
! // expects a valid thread object oop. And we need to call signal.
! void post_run() {
Threads::remove(this);
_post->signal();
this->smr_delete();
}
< prev index next >