Changeset 5912
- Timestamp:
- Nov 22, 2018 2:39:29 AM (6 years ago)
- Location:
- pjproject/trunk/pjsip
- Files:
-
- 2 edited
Legend:
- Unmodified
- Added
- Removed
-
pjproject/trunk/pjsip/include/pjsua2/endpoint.hpp
r5904 r5912 29 29 #include <list> 30 30 #include <map> 31 #include <mutex>32 31 33 32 /** PJSUA2 API is inside pj namespace */ … … 1598 1597 CodecInfoVector videoCodecInfoList; 1599 1598 std::map<pj_thread_t*, pj_thread_desc*> threadDescMap; 1600 std::mutexthreadDescMutex;1599 pj_mutex_t *threadDescMutex; 1601 1600 1602 1601 /* Pending logging */ -
pjproject/trunk/pjsip/src/pjsua2/endpoint.cpp
r5904 r5912 480 480 */ 481 481 Endpoint::Endpoint() 482 : writer(NULL), mainThreadOnly(false), mainThread(NULL), pendingJobSize(0) 482 : writer(NULL), threadDescMutex(NULL), mainThreadOnly(false), 483 mainThread(NULL), pendingJobSize(0) 483 484 { 484 485 if (instance_) { … … 1689 1690 threadDescMap[t] = NULL; 1690 1691 } 1692 1693 PJSUA2_CHECK_EXPR( pj_mutex_create_simple(pjsua_var.pool, "threadDesc", 1694 &threadDescMutex) ); 1691 1695 } 1692 1696 … … 1711 1715 status = pj_thread_register(name.c_str(), *desc, &thread); 1712 1716 if (status == PJ_SUCCESS) { 1713 std::lock_guard<std::mutex> guard(threadDescMutex);1717 pj_mutex_lock(threadDescMutex); 1714 1718 threadDescMap[thread] = desc; 1719 pj_mutex_unlock(threadDescMutex); 1715 1720 } else { 1716 1721 free(desc); … … 1722 1727 { 1723 1728 if (pj_thread_is_registered()) { 1724 std::lock_guard<std::mutex> guard(threadDescMutex); 1729 bool found; 1730 1731 pj_mutex_lock(threadDescMutex); 1725 1732 /* Recheck again if it exists in the thread description map */ 1726 return (threadDescMap.find(pj_thread_this()) != threadDescMap.end()); 1733 found = (threadDescMap.find(pj_thread_this()) != threadDescMap.end()); 1734 pj_mutex_unlock(threadDescMutex); 1735 1736 return found; 1727 1737 } 1728 1738 … … 1744 1754 { 1745 1755 pj_status_t status; 1756 1757 if (threadDescMutex) { 1758 pj_mutex_destroy(threadDescMutex); 1759 threadDescMutex = NULL; 1760 } 1746 1761 1747 1762 status = pjsua_destroy2(flags);
Note: See TracChangeset
for help on using the changeset viewer.