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
This commit is contained in:
Keith Seitz 2006-07-21 23:45:03 +00:00 committed by Keith Seitz
parent 2e5757965d
commit 303f32ccd7
7 changed files with 71 additions and 67 deletions

View file

@ -1,3 +1,18 @@
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>
PR libgcj/28426

View file

@ -678,19 +678,20 @@ _Jv_RegisterLibForGc (const void *p __attribute__ ((__unused__)))
#endif
}
#if defined(GC_PTHREADS) && !defined(GC_SOLARIS_THREADS) \
&& !defined(GC_WIN32_THREADS) && !defined(GC_DARWIN_THREADS)
void
_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));
#endif
}
void
_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));
}
#endif
}

View file

@ -374,18 +374,4 @@ void _Jv_ThreadWait (void);
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__ */

View file

@ -193,20 +193,6 @@ void _Jv_ThreadInterrupt (_Jv_Thread_t *data);
// See java/lang/natWin32Process.cc (waitFor) for an example.
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
#undef TRUE

View file

@ -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

View file

@ -505,22 +505,6 @@ _Jv_ThreadWait (void)
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)
#include "sysdep/locks.h"

View file

@ -420,19 +420,3 @@ _Jv_ThreadInterrupt (_Jv_Thread_t *data)
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;
}