diff options
author | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-07-21 23:45:03 +0000 |
---|---|---|
committer | kseitz <kseitz@138bc75d-0d04-0410-961f-82ee72b054a4> | 2006-07-21 23:45:03 +0000 |
commit | 2a6bfcdb6193f403cc835ca05303f390c0c29e97 (patch) | |
tree | d9fcf70f352ec397fa6065457951b478894479a5 /libjava/jvmti.cc | |
parent | ee7d0a6f2e65fa26985470946dab9c1d9d10fff5 (diff) | |
download | gcc-2a6bfcdb6193f403cc835ca05303f390c0c29e97.tar.gz |
* boehm.cc (_Jv_SuspendThread): Don't ifdef the function declaration,
just the contents.
(_Jv_ResumeThread): Likewise.
* posix-threads.cc: Revert 2006-06-19 _Jv_ThreadDebugSuspend,
_Jv_ThreadDebugResume, _Jv_ThreadDebugSuspendCount patch. Moving
to JVMTI instead.
* include/posix-threads.h: Likewise.
* win32-threads.cc: Likewise.
* include/win32-threads.h: Likewise.
* jvmti.cc (_Jv_JVMTI_SuspentThread): New function.
(_Jv_JVMTI_ResumeThread): New function.
(_Jv_JVMTI_Interface): Define SuspendThread and ResumeThread.
git-svn-id: svn+ssh://gcc.gnu.org/svn/gcc/trunk@115655 138bc75d-0d04-0410-961f-82ee72b054a4
Diffstat (limited to 'libjava/jvmti.cc')
-rw-r--r-- | libjava/jvmti.cc | 52 |
1 files changed, 50 insertions, 2 deletions
diff --git a/libjava/jvmti.cc b/libjava/jvmti.cc index 16a28f179f7..8c2b294bc38 100644 --- a/libjava/jvmti.cc +++ b/libjava/jvmti.cc @@ -11,8 +11,56 @@ details. */ #include <config.h> #include <jvm.h> +#include <java-threads.h> +#include <java-gc.h> #include <jvmti.h> +#include <java/lang/Thread.h> + +// Some commonly-used checks + +#define THREAD_DEFAULT_TO_CURRENT(jthread) \ + if (jthread == NULL) jthread = java::lang::Thread::currentThread (); + +#define THREAD_CHECK_VALID(jthread) \ + if (!java::lang::Thread::class$.isAssignableFrom (&(jthread->class$))) \ + return JVMTI_ERROR_INVALID_THREAD; + +#define THREAD_CHECK_IS_ALIVE(thread) \ + if (!thread->isAlive ()) return JVMTI_ERROR_THREAD_NOT_ALIVE; + +static jvmtiError +_Jv_JVMTI_SuspendThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) +{ + using namespace java::lang; + + THREAD_DEFAULT_TO_CURRENT (thread); + THREAD_CHECK_VALID (thread); + + Thread *t = reinterpret_cast<Thread *> (thread); + THREAD_CHECK_IS_ALIVE (t); + + _Jv_Thread_t *data = _Jv_ThreadGetData (t); + _Jv_SuspendThread (data); + return JVMTI_ERROR_NONE; +} + +static jvmtiError +_Jv_JVMTI_ResumeThread (MAYBE_UNUSED jvmtiEnv *env, jthread thread) +{ + using namespace java::lang; + + THREAD_DEFAULT_TO_CURRENT (thread); + THREAD_CHECK_VALID (thread); + + Thread *t = reinterpret_cast<Thread *> (thread); + THREAD_CHECK_IS_ALIVE (t); + + _Jv_Thread_t *data = _Jv_ThreadGetData (t); + _Jv_ResumeThread (data); + return JVMTI_ERROR_NONE; +} + #define RESERVED NULL #define UNIMPLEMENTED NULL @@ -30,8 +78,8 @@ struct _Jv_jvmtiEnv _Jv_JVMTI_Interface = UNIMPLEMENTED, // SetEventNotification RESERVED, // reserved3 UNIMPLEMENTED, // GetAllThreads - UNIMPLEMENTED, // SuspendThread - UNIMPLEMENTED, // ResumeThread + _Jv_JVMTI_SuspendThread, // SuspendThread + _Jv_JVMTI_ResumeThread, // ResumeThread UNIMPLEMENTED, // StopThread UNIMPLEMENTED, // InterruptThread UNIMPLEMENTED, // GetThreadInfo |