MCPcopy Create free account
hub / github.com/KDE/kdevelop / UrlParseLock

Method UrlParseLock

kdevplatform/language/backgroundparser/urlparselock.cpp:40–60  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

38}
39
40UrlParseLock::UrlParseLock(const IndexedString& url)
41 : m_url(url)
42{
43 QMutexLocker lock(&parsingUrlsMutex);
44
45 // NOTE: operator[] default-initializes the ptr to zero for us when not available
46 auto& perUrlData = parsingUrls()[url];
47 if (!perUrlData) {
48 // if that was the case, we are the first to parse this url, create an entry
49 perUrlData = new PerUrlData;
50 }
51
52 // always increment the refcount
53 ++perUrlData->ref;
54
55 // now lock the url, but don't do so while blocking the global mutex
56 auto& mutex = perUrlData->mutex;
57 lock.unlock();
58
59 mutex.lock();
60}
61
62UrlParseLock::~UrlParseLock()
63{

Callers

nothing calls this directly

Calls 2

unlockMethod · 0.45
lockMethod · 0.45

Tested by

no test coverage detected