[asterisk-scf-commits] asterisk-scf/release/media_rtp_pjmedia.git branch "master" updated.

Commits to the Asterisk SCF project code repositories asterisk-scf-commits at lists.digium.com
Tue May 24 11:25:48 CDT 2011


branch "master" has been updated
       via  e8164ed94af4df2f2d74b568cdaf7be78f666aba (commit)
      from  1d8328968ea8ea5b276643c9b36365f2edb5933c (commit)

Summary of changes:
 src/MediaRTPpjmedia.cpp |    7 +++++++
 1 files changed, 7 insertions(+), 0 deletions(-)


- Log -----------------------------------------------------------------
commit e8164ed94af4df2f2d74b568cdaf7be78f666aba
Author: Brent Eagles <beagles at digium.com>
Date:   Tue May 24 13:54:58 2011 -0230

    Add locking to the thread hashtable to keep it from getting corrupted.

diff --git a/src/MediaRTPpjmedia.cpp b/src/MediaRTPpjmedia.cpp
index b05c352..93d6eae 100644
--- a/src/MediaRTPpjmedia.cpp
+++ b/src/MediaRTPpjmedia.cpp
@@ -367,6 +367,7 @@ public:
         ThreadDescWrapperPtr wrapper = ThreadDescWrapperPtr(new ThreadDescWrapper());
         pj_thread_t *thread;
         pj_thread_register("ICE Thread", wrapper->mDesc, &thread);
+        boost::lock_guard<boost::mutex> lock(mLock);
         pjThreads.insert(make_pair(thread, wrapper));
     }
 
@@ -377,6 +378,7 @@ public:
     {
         if (pj_thread_is_registered())
         {
+            boost::lock_guard<boost::mutex> lock(mLock);
             pjThreads.erase(pj_thread_this());
         }
     }
@@ -385,6 +387,11 @@ private:
      * A map containing thread lifetime persistent data.
      */
     map<pj_thread_t*, ThreadDescWrapperPtr> pjThreads;
+
+    /**
+     * Mutex to protect the map
+     */
+    boost::mutex mLock;
 };
 
 /**

-----------------------------------------------------------------------


-- 
asterisk-scf/release/media_rtp_pjmedia.git



More information about the asterisk-scf-commits mailing list