Commit 303f32cc by Keith Seitz Committed by Keith Seitz

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
parent 2e575796
2006-07-21 Keith Seitz <keiths@redhat.com>
* 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.
2006-07-21 David Daney <ddaney@avtrex.com> 2006-07-21 David Daney <ddaney@avtrex.com>
PR libgcj/28426 PR libgcj/28426
......
...@@ -678,19 +678,20 @@ _Jv_RegisterLibForGc (const void *p __attribute__ ((__unused__))) ...@@ -678,19 +678,20 @@ _Jv_RegisterLibForGc (const void *p __attribute__ ((__unused__)))
#endif #endif
} }
#if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
&& !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
void void
_Jv_SuspendThread (_Jv_Thread_t *thread) _Jv_SuspendThread (_Jv_Thread_t *thread)
{ {
#if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
&& !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
GC_suspend_thread (_Jv_GetPlatformThreadID (thread)); GC_suspend_thread (_Jv_GetPlatformThreadID (thread));
#endif
} }
void void
_Jv_ResumeThread (_Jv_Thread_t *thread) _Jv_ResumeThread (_Jv_Thread_t *thread)
{ {
#if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
&& !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
GC_resume_thread (_Jv_GetPlatformThreadID (thread)); GC_resume_thread (_Jv_GetPlatformThreadID (thread));
}
#endif #endif
}
...@@ -374,18 +374,4 @@ void _Jv_ThreadWait (void); ...@@ -374,18 +374,4 @@ void _Jv_ThreadWait (void);
void _Jv_ThreadInterrupt (_Jv_Thread_t *data); void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
// Increases a thread's suspend count. If the thread's previous
// suspend count was zero, i.e., it is not suspended, this function
// will suspend the thread. This function may be used to suspend
// any thread from any other thread (or suspend itself).
void _Jv_ThreadDebugSuspend (_Jv_Thread_t *data);
// Decreases a thread's suspend count. If the thread's new thread
// count is zero, the thread is resumed. This function may be used
// by any thread to resume any other thread.
void _Jv_ThreadDebugResume (_Jv_Thread_t *data);
// Get the suspend count for a thread
jint _Jv_ThreadDebugSuspendCount (_Jv_Thread_t *data);
#endif /* __JV_POSIX_THREADS__ */ #endif /* __JV_POSIX_THREADS__ */
...@@ -193,20 +193,6 @@ void _Jv_ThreadInterrupt (_Jv_Thread_t *data); ...@@ -193,20 +193,6 @@ void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
// See java/lang/natWin32Process.cc (waitFor) for an example. // See java/lang/natWin32Process.cc (waitFor) for an example.
HANDLE _Jv_Win32GetInterruptEvent (void); HANDLE _Jv_Win32GetInterruptEvent (void);
// Increases a thread's suspend count. If the thread's previous
// suspend count was zero, i.e., it is not suspended, this function
// will suspend the thread. This function may be used to suspend
// any thread from any other thread (or suspend itself).
void _Jv_ThreadDebugSuspend (_Jv_Thread_t *data);
// Decreases a thread's suspend count. If the thread's new thread
// count is zero, the thread is resumed. This function may be used
// by any thread to resume any other thread.
void _Jv_ThreadDebugResume (_Jv_Thread_t *data);
// Get the suspend count for a thread
jint _Jv_ThreadDebugSuspendCount (_Jv_Thread_t *data);
// Remove defines from <windows.h> that conflict with various things in libgcj code // Remove defines from <windows.h> that conflict with various things in libgcj code
#undef TRUE #undef TRUE
......
...@@ -11,8 +11,56 @@ details. */ ...@@ -11,8 +11,56 @@ details. */
#include <config.h> #include <config.h>
#include <jvm.h> #include <jvm.h>
#include <java-threads.h>
#include <java-gc.h>
#include <jvmti.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 RESERVED NULL
#define UNIMPLEMENTED NULL #define UNIMPLEMENTED NULL
...@@ -30,8 +78,8 @@ struct _Jv_jvmtiEnv _Jv_JVMTI_Interface = ...@@ -30,8 +78,8 @@ struct _Jv_jvmtiEnv _Jv_JVMTI_Interface =
UNIMPLEMENTED, // SetEventNotification UNIMPLEMENTED, // SetEventNotification
RESERVED, // reserved3 RESERVED, // reserved3
UNIMPLEMENTED, // GetAllThreads UNIMPLEMENTED, // GetAllThreads
UNIMPLEMENTED, // SuspendThread _Jv_JVMTI_SuspendThread, // SuspendThread
UNIMPLEMENTED, // ResumeThread _Jv_JVMTI_ResumeThread, // ResumeThread
UNIMPLEMENTED, // StopThread UNIMPLEMENTED, // StopThread
UNIMPLEMENTED, // InterruptThread UNIMPLEMENTED, // InterruptThread
UNIMPLEMENTED, // GetThreadInfo UNIMPLEMENTED, // GetThreadInfo
......
...@@ -505,22 +505,6 @@ _Jv_ThreadWait (void) ...@@ -505,22 +505,6 @@ _Jv_ThreadWait (void)
pthread_mutex_unlock (&daemon_mutex); pthread_mutex_unlock (&daemon_mutex);
} }
void
_Jv_ThreadDebugSuspend (_Jv_Thread_t *data)
{
}
void
_Jv_ThreadDebugResume (_Jv_Thread_t *data)
{
}
jint
_Jv_ThreadDebugSuspendCount (_Jv_Thread_t *data)
{
return -1;
}
#if defined(SLOW_PTHREAD_SELF) #if defined(SLOW_PTHREAD_SELF)
#include "sysdep/locks.h" #include "sysdep/locks.h"
......
...@@ -420,19 +420,3 @@ _Jv_ThreadInterrupt (_Jv_Thread_t *data) ...@@ -420,19 +420,3 @@ _Jv_ThreadInterrupt (_Jv_Thread_t *data)
LeaveCriticalSection (&data->interrupt_mutex); LeaveCriticalSection (&data->interrupt_mutex);
} }
void
_Jv_ThreadDebugSuspend (_Jv_Thread_t *data)
{
}
void
_Jv_ThreadDebugResume (_Jv_Thread_t *data)
{
}
jint
_Jv_ThreadDebugSuspendCount (_Jv_Thread_t *data)
{
return -1;
}
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment