Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.
View | Details | Raw Unified | Return to bug 190796
Collapse All | Expand All

(-)src-native/src/Martini/Infrastructure/JPI/ThreadInfoManager.cpp (-11 / +19 lines)
Lines 32-38 Link Here
32
32
33
CThreadInfoManager::CThreadInfoManager()
33
CThreadInfoManager::CThreadInfoManager()
34
: m_ptlsThreadInfo(NULL), m_pcsThreadManager(NULL), m_pEventManager(NULL),
34
: m_ptlsThreadInfo(NULL), m_pcsThreadManager(NULL), m_pEventManager(NULL),
35
    m_pThreadIdAllocator(NULL), m_pVMInterfafe(NULL)
35
    m_pThreadIdAllocator(NULL), m_pVMInterface(NULL)
36
{
36
{
37
37
38
}
38
}
Lines 54-60 Link Here
54
TResult CThreadInfoManager::Init(CEventManager *pEventManager)
54
TResult CThreadInfoManager::Init(CEventManager *pEventManager)
55
{
55
{
56
    m_pEventManager = pEventManager;
56
    m_pEventManager = pEventManager;
57
    m_pVMInterfafe = CJpiGlobals::Instance()->pJvmInterface;
57
    m_pVMInterface = CJpiGlobals::Instance()->pJvmInterface;
58
58
59
    // Initialize Critical Section
59
    // Initialize Critical Section
60
    if (!m_pcsThreadManager)
60
    if (!m_pcsThreadManager)
Lines 112-118 Link Here
112
    }
112
    }
113
    else
113
    else
114
    {
114
    {
115
        threadWeakGlobalRef = const_cast<JNIEnv*>(pJniEnv)->NewWeakGlobalRef(threadRef);
115
        JNIEnv* pCurrentJniEnv;
116
        TResult res = m_pVMInterface->GetJNIEnv(&pCurrentJniEnv);
117
        if (MRTE_FAILED(res))
118
        {
119
            MARTINI_INFORMATIVE("CThreadInfoManager", 0, false, 
120
                "failed to obtain JNI environment of the calling thread");
121
            return MRTE_ERROR_FAIL;
122
        }
123
        threadWeakGlobalRef = pCurrentJniEnv->NewWeakGlobalRef(threadRef);
116
        if (NULL == threadWeakGlobalRef)
124
        if (NULL == threadWeakGlobalRef)
117
        {
125
        {
118
            MARTINI_ERROR("CThreadInfoManager", 
126
            MARTINI_ERROR("CThreadInfoManager", 
Lines 251-257 Link Here
251
        memset(&threadInfo, 0, sizeof(SThreadInfo));
259
        memset(&threadInfo, 0, sizeof(SThreadInfo));
252
        if (thread != NULL)
260
        if (thread != NULL)
253
        {
261
        {
254
            m_pVMInterfafe->GetThreadInfo(&threadInfo, thread);
262
            m_pVMInterface->GetThreadInfo(&threadInfo, thread);
255
        }
263
        }
256
        iRes = ThreadStart(&threadId, pJniEnv, thread, true, threadInfo.szName, 
264
        iRes = ThreadStart(&threadId, pJniEnv, thread, true, threadInfo.szName, 
257
            threadInfo.szGroupName, threadInfo.szParentGroupName);
265
            threadInfo.szGroupName, threadInfo.szParentGroupName);
Lines 356-362 Link Here
356
        if (NULL != pTlsThreadInfo && NULL == pTlsThreadInfo->threadInfo.szName)
364
        if (NULL != pTlsThreadInfo && NULL == pTlsThreadInfo->threadInfo.szName)
357
        {
365
        {
358
            SThreadInfo threadInfo;
366
            SThreadInfo threadInfo;
359
            TResult iRes = m_pVMInterfafe->GetThreadInfo(&threadInfo, 
367
            TResult iRes = m_pVMInterface->GetThreadInfo(&threadInfo, 
360
                pTlsThreadInfo->wgrThread);
368
                pTlsThreadInfo->wgrThread);
361
            if (MRTE_SUCCEEDED(iRes))
369
            if (MRTE_SUCCEEDED(iRes))
362
            {
370
            {
Lines 443-449 Link Here
443
            if (STlsThreadInfo::ALIVE == pTlsThreadInfo->threadState
451
            if (STlsThreadInfo::ALIVE == pTlsThreadInfo->threadState
444
                && STlsThreadInfo::JAVA == pTlsThreadInfo->threadType)
452
                && STlsThreadInfo::JAVA == pTlsThreadInfo->threadType)
445
            {
453
            {
446
                TResult iRes = m_pVMInterfafe->SuspendThread(pTlsThreadInfo->wgrThread);
454
                TResult iRes = m_pVMInterface->SuspendThread(pTlsThreadInfo->wgrThread);
447
                if (MRTE_SUCCEEDED(iRes))
455
                if (MRTE_SUCCEEDED(iRes))
448
                {
456
                {
449
                    pTlsThreadInfo->threadState = STlsThreadInfo::SUSPENDED;
457
                    pTlsThreadInfo->threadState = STlsThreadInfo::SUSPENDED;
Lines 481-487 Link Here
481
        {
489
        {
482
            if (STlsThreadInfo::SUSPENDED == pTlsThreadInfo->threadState)
490
            if (STlsThreadInfo::SUSPENDED == pTlsThreadInfo->threadState)
483
            {
491
            {
484
                TResult iRes = m_pVMInterfafe->ResumeThread(pTlsThreadInfo->wgrThread);
492
                TResult iRes = m_pVMInterface->ResumeThread(pTlsThreadInfo->wgrThread);
485
                if (MRTE_SUCCEEDED(iRes))
493
                if (MRTE_SUCCEEDED(iRes))
486
                {
494
                {
487
                    pTlsThreadInfo->threadState = STlsThreadInfo::ALIVE;
495
                    pTlsThreadInfo->threadState = STlsThreadInfo::ALIVE;
Lines 553-559 Link Here
553
{
561
{
554
    TThreadInfoVector threadInfoVec;
562
    TThreadInfoVector threadInfoVec;
555
    JNIEnv *pJniEnv;
563
    JNIEnv *pJniEnv;
556
    TResult res = m_pVMInterfafe->GetJNIEnv(&pJniEnv);
564
    TResult res = m_pVMInterface->GetJNIEnv(&pJniEnv);
557
    if (MRTE_FAILED(res))
565
    if (MRTE_FAILED(res))
558
    {
566
    {
559
        return 0;
567
        return 0;
Lines 590-596 Link Here
590
        }
598
        }
591
        thread = pTlsInfo->wgrThread;
599
        thread = pTlsInfo->wgrThread;
592
    }
600
    }
593
    return m_pVMInterfafe->GetStackTrace(pFrameBuffer, pFrameCount, thread, 0, maxFrameCount);
601
    return m_pVMInterface->GetStackTrace(pFrameBuffer, pFrameCount, thread, 0, maxFrameCount);
594
}
602
}
595
603
596
TResult CThreadInfoManager::GetState(EThreadState *pState, TId threadId)
604
TResult CThreadInfoManager::GetState(EThreadState *pState, TId threadId)
Lines 608-620 Link Here
608
        thread = pTlsInfo->wgrThread;
616
        thread = pTlsInfo->wgrThread;
609
    }
617
    }
610
    jint jvmState = 0;
618
    jint jvmState = 0;
611
    TResult res = m_pVMInterfafe->GetThreadState(&jvmState, thread);
619
    TResult res = m_pVMInterface->GetThreadState(&jvmState, thread);
612
    if (MRTE_FAILED(res))
620
    if (MRTE_FAILED(res))
613
    {
621
    {
614
        return res;
622
        return res;
615
    }
623
    }
616
624
617
    *pState = m_pVMInterfafe->VmThreadStateToMpiThreadState(jvmState);
625
    *pState = m_pVMInterface->VmThreadStateToMpiThreadState(jvmState);
618
    
626
    
619
    return MRTE_RESULT_OK;
627
    return MRTE_RESULT_OK;
620
}
628
}
(-)src-native/src/Martini/Infrastructure/JPI/ThreadInfoManager.h (-1 / +1 lines)
Lines 353-359 Link Here
353
        CEventManager *m_pEventManager;
353
        CEventManager *m_pEventManager;
354
354
355
        // Pointer to the VM interface
355
        // Pointer to the VM interface
356
        IJVM *m_pVMInterfafe;
356
        IJVM *m_pVMInterface;
357
        
357
        
358
        // Critical section to guard Thread Manager's internal databases
358
        // Critical section to guard Thread Manager's internal databases
359
        OSA::IThreadSync *m_pcsThreadManager;
359
        OSA::IThreadSync *m_pcsThreadManager;

Return to bug 190796