diff options
author | Keith Seitz <keiths@redhat.com> | 2006-07-21 23:45:03 +0000 |
---|---|---|
committer | Keith Seitz <kseitz@gcc.gnu.org> | 2006-07-21 23:45:03 +0000 |
commit | 303f32ccd7cdf2e5cf1035a56599905ace682dbc (patch) | |
tree | d9fcf70f352ec397fa6065457951b478894479a5 /libjava/jvmti.cc | |
parent | 2e5757965dee9def53422009da26f51aa243b18d (diff) | |
download | gcc-303f32ccd7cdf2e5cf1035a56599905ace682dbc.zip gcc-303f32ccd7cdf2e5cf1035a56599905ace682dbc.tar.gz gcc-303f32ccd7cdf2e5cf1035a56599905ace682dbc.tar.bz2 |
boehm.cc (_Jv_SuspendThread): Don't ifdef the function declaration, just the contents.
* 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.
From-SVN: r115655
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 16a28f1..8c2b294 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 |