VirtualBox

Ignore:
Timestamp:
Jul 5, 2010 12:43:41 PM (14 years ago)
Author:
vboxsync
Message:

webservice: add missing mutex for thread logging identifiers (helgrind complaints)

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/VBox/Main/webservice/vboxweb.cpp

    r30607 r30609  
    129129ULONG64             g_iMaxManagedObjectID = 0;
    130130ULONG64             g_cManagedObjects = 0;
     131
     132// this mutex protects g_mapThreads
     133util::RWLockHandle  *g_pThreadsLockHandle;
    131134
    132135// Threads map, so we can quickly map an RTTHREAD struct to a logger prefix
     
    326329                                             m_soap);
    327330            m_llAllThreads.push_back(pst);
     331            util::AutoWriteLock thrLock(g_pThreadsLockHandle COMMA_LOCKVAL_SRC_POS);
    328332            g_mapThreads[pst->m_pThread] = com::Utf8StrFmt("[%3u]", pst->m_u);
    329333            ++m_cIdleThreads;
     
    455459
    456460    const char *pcszPrefix = "[   ]";
     461    util::AutoReadLock thrLock(g_pThreadsLockHandle COMMA_LOCKVAL_SRC_POS);
    457462    ThreadsMap::iterator it = g_mapThreads.find(RTThreadSelf());
    458463    if (it != g_mapThreads.end())
    459464        pcszPrefix = it->second.c_str();
     465    thrLock.release();
    460466
    461467    // terminal
     
    557563{
    558564    // store a log prefix for this thread
     565    util::AutoWriteLock thrLock(g_pThreadsLockHandle COMMA_LOCKVAL_SRC_POS);
    559566    g_mapThreads[RTThreadSelf()] = "[ P ]";
     567    thrLock.release();
    560568
    561569    doQueuesLoop();
     
    701709    g_pAuthLibLockHandle = new util::WriteLockHandle(util::LOCKCLASS_WEBSERVICE);
    702710    g_pSessionsLockHandle = new util::WriteLockHandle(util::LOCKCLASS_WEBSERVICE);
     711    g_pThreadsLockHandle = new util::RWLockHandle(util::LOCKCLASS_OBJECTSTATE);
    703712
    704713    // SOAP queue pumper thread
     
    765774{
    766775    // store a log prefix for this thread
     776    util::AutoWriteLock thrLock(g_pThreadsLockHandle COMMA_LOCKVAL_SRC_POS);
    767777    g_mapThreads[RTThreadSelf()] = "[W  ]";
     778    thrLock.release();
    768779
    769780    WEBDEBUG(("Watchdog thread started\n"));
Note: See TracChangeset for help on using the changeset viewer.

© 2024 Oracle Support Privacy / Do Not Sell My Info Terms of Use Trademark Policy Automated Access Etiquette