Changeset 5904 for pjproject


Ignore:
Timestamp:
Nov 5, 2018 2:40:54 AM (5 years ago)
Author:
ming
Message:

Fixed #2159: Add synchronization for Endpoint::libRegisterThread()

Location:
pjproject/trunk/pjsip
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp

    r5834 r5904  
    2929#include <list> 
    3030#include <map> 
     31#include <mutex> 
    3132 
    3233/** PJSUA2 API is inside pj namespace */ 
     
    15971598    CodecInfoVector              videoCodecInfoList; 
    15981599    std::map<pj_thread_t*, pj_thread_desc*> threadDescMap; 
     1600    std::mutex                   threadDescMutex; 
    15991601 
    16001602    /* Pending logging */ 
  • pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp

    r5899 r5904  
    17111711    status = pj_thread_register(name.c_str(), *desc, &thread); 
    17121712    if (status == PJ_SUCCESS) { 
     1713        std::lock_guard<std::mutex> guard(threadDescMutex); 
    17131714        threadDescMap[thread] = desc; 
    17141715    } else { 
     
    17211722{ 
    17221723    if (pj_thread_is_registered()) { 
     1724        std::lock_guard<std::mutex> guard(threadDescMutex); 
    17231725        /* Recheck again if it exists in the thread description map */ 
    17241726        return (threadDescMap.find(pj_thread_this()) != threadDescMap.end()); 
Note: See TracChangeset for help on using the changeset viewer.