jdktools/modules/jpda/src/main/native/jdwp/common/agent/core/ThreadManager.cpp
void ThreadManager::RemoveJavaThread(JNIEnv *jni, jthread thread) {
    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "RemoveJavaThread(%p,%p)", jni, thread));

    MonitorAutoLock lock(m_javathrdmgrMonitor JDWP_FILE_LINE);

    JavaThreadInfoList::iterator result = m_javaThreadInfoList.begin();
    for (;result.hasNext();) {
        JavaThreadInfo* element = result.getNext();
        if (element != NULL && jni->IsSameObject((element)->m_thread, thread) == JNI_TRUE) {
            // thread found, remove from list and destroy
            m_javaThreadInfoList.remove(result.getIndex());
            (element)->Clean(jni);
    	    delete element;
    	    element = 0;
    	    JDWP_TRACE(LOG_RELEASE, (LOG_THREAD_FL, "RemoveJavaThread: add thread=%p", thread));
    	    break;
    	}
    }
}
/**
 * Remove a Java thread from the list 
 *  
 * @param jni - the JNI interface pointer 
 * @param thread - the Java thread to remove 
 */
Remove a Java thread from the list

@param jni - the JNI interface pointer
@param thread - the Java thread to remove
Remove a Java thread from the list @param jni - the JNI interface pointer @param thread - the Java thread to remove
void ThreadManager::RemoveJavaThread(JNIEnv *jni, jthread thread) {
    JDWP_TRACE_ENTRY(LOG_RELEASE, (LOG_FUNC_FL, "RemoveJavaThread(%p,%p)", jni, thread));
    MonitorAutoLock lock(m_javathrdmgrMonitor JDWP_FILE_LINE);
    JavaThreadInfoList::iterator result = m_javaThreadInfoList.begin();
    for (;result.hasNext();) {
        JavaThreadInfo* element = result.getNext();
        if (element != NULL && jni->IsSameObject((element)->m_thread, thread) == JNI_TRUE) {
            m_javaThreadInfoList.remove(result.getIndex());
            (element)->Clean(jni);
    	    delete element;
    	    element = 0;
    	    JDWP_TRACE(LOG_RELEASE, (LOG_THREAD_FL, "RemoveJavaThread: add thread=%p", thread));
    	    break;
    	}
    }
}
void ThreadManager :: RemoveJavaThread ( JNIEnv * jni , jthread thread ) { JDWP_TRACE_ENTRY ( LOG_RELEASE , ( LOG_FUNC_FL , " " , jni , thread ) ) ; MonitorAutoLock lock ( m_javathrdmgrMonitor JDWP_FILE_LINE ) ; JavaThreadInfoList :: iterator result = m_javaThreadInfoList . begin ( ) ; for ( ; result . hasNext ( ) ; ) { JavaThreadInfo * element = result . getNext ( ) ; if ( element != NULL && jni -> IsSameObject ( ( element ) -> m_thread , thread ) == JNI_TRUE ) { m_javaThreadInfoList . remove ( result . getIndex ( ) ) ; ( element ) -> Clean ( jni ) ; delete element ; element = 0 ; JDWP_TRACE ( LOG_RELEASE , ( LOG_THREAD_FL , " " , thread ) ) ; break ; } } }
Remove a Java thread from the list
Remove a Java thread from the list
// thread found, remove from list and destroy