This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[RFA/JVMTI] Thread start/end notifications
- From: Keith Seitz <keiths at redhat dot com>
- To: Java Patch List <java-patches at gcc dot gnu dot org>
- Date: Mon, 15 Jan 2007 23:14:23 -0800
- Subject: [RFA/JVMTI] Thread start/end notifications
Hi,
The attached patch adds JVMTI event notifications for thread start and
end. I simply put them in the same places where the JVMPI notifications
were placed.
Ok?
Keith
ChangeLog
2007-01-15 Keith Seitz <keiths@redhat.com>
* java/lang/natThread.cc (finish_): Add JVMTI ThreadEnd
notification.
(_Jv_NotifyThreadStart): Add JVMTI ThreadStart notification.
Index: java/lang/natThread.cc
===================================================================
--- java/lang/natThread.cc (revision 120674)
+++ java/lang/natThread.cc (working copy)
@@ -1,6 +1,6 @@
// natThread.cc - Native part of Thread class.
-/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2006 Free Software Foundation
+/* Copyright (C) 1998, 1999, 2000, 2001, 2002, 2005, 2006, 2007 Free Software Foundation
This file is part of libgcj.
@@ -27,6 +27,8 @@
#include <java/lang/NullPointerException.h>
#include <jni.h>
+#include <jvmti.h>
+#include "jvmti-int.h"
#ifdef ENABLE_JVMPI
#include <jvmpi.h>
@@ -215,6 +217,12 @@
nt->park_helper.deactivate ();
group->removeThread (this);
+ if (JVMTI_REQUESTED_EVENT (ThreadEnd))
+ {
+ JNIEnv *jni_env = reinterpret_cast<JNIEnv *> (nt->jni_env);
+ _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_END, this, jni_env);
+ }
+
#ifdef ENABLE_JVMPI
if (_Jv_JVMPI_Notify_THREAD_END)
{
@@ -253,6 +261,13 @@
static void
_Jv_NotifyThreadStart (java::lang::Thread* thread)
{
+ if (JVMTI_REQUESTED_EVENT (ThreadStart))
+ {
+ natThread *nt = reinterpret_cast<natThread *> (thread->data);
+ JNIEnv *jni_env = reinterpret_cast<JNIEnv *> (nt->jni_env);
+ _Jv_JVMTI_PostEvent (JVMTI_EVENT_THREAD_START, thread, jni_env);
+ }
+
#ifdef ENABLE_JVMPI
if (_Jv_JVMPI_Notify_THREAD_START)
{