osl::Mutex->std::mutex in librdf_NamedGraph

Change-Id: If28bef2bd44dc469e6534b166d4c25c0a7c3b2eb
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133968
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
This commit is contained in:
Noel Grandin
2022-05-07 08:43:40 +02:00
committed by Noel Grandin
parent 9313b6c02c
commit 6e8f63f772

View File

@@ -741,7 +741,7 @@ private:
/// Querying is rather slow, so cache the results. /// Querying is rather slow, so cache the results.
std::map<OUString, std::vector<rdf::Statement>> m_aStatementsCache; std::map<OUString, std::vector<rdf::Statement>> m_aStatementsCache;
::osl::Mutex m_CacheMutex; std::mutex m_CacheMutex;
}; };
@@ -783,7 +783,7 @@ void SAL_CALL librdf_NamedGraph::clear()
throw lang::WrappedTargetRuntimeException( ex.Message, throw lang::WrappedTargetRuntimeException( ex.Message,
*this, anyEx ); *this, anyEx );
} }
::osl::MutexGuard g(m_CacheMutex); std::unique_lock g(m_CacheMutex);
m_aStatementsCache.clear(); m_aStatementsCache.clear();
} }
@@ -798,7 +798,7 @@ void SAL_CALL librdf_NamedGraph::addStatement(
"librdf_NamedGraph::addStatement: repository is gone", *this); "librdf_NamedGraph::addStatement: repository is gone", *this);
} }
{ {
::osl::MutexGuard g(m_CacheMutex); std::unique_lock g(m_CacheMutex);
m_aStatementsCache.clear(); m_aStatementsCache.clear();
} }
m_pRep->addStatementGraph_NoLock( m_pRep->addStatementGraph_NoLock(
@@ -816,7 +816,7 @@ void SAL_CALL librdf_NamedGraph::removeStatements(
"librdf_NamedGraph::removeStatements: repository is gone", *this); "librdf_NamedGraph::removeStatements: repository is gone", *this);
} }
{ {
::osl::MutexGuard g(m_CacheMutex); std::unique_lock g(m_CacheMutex);
m_aStatementsCache.clear(); m_aStatementsCache.clear();
} }
m_pRep->removeStatementsGraph_NoLock( m_pRep->removeStatementsGraph_NoLock(
@@ -845,7 +845,7 @@ librdf_NamedGraph::getStatements(
{ {
OUString cacheKey = createCacheKey_NoLock(i_xSubject, i_xPredicate, i_xObject); OUString cacheKey = createCacheKey_NoLock(i_xSubject, i_xPredicate, i_xObject);
{ {
::osl::MutexGuard g(m_CacheMutex); std::unique_lock g(m_CacheMutex);
auto it = m_aStatementsCache.find(cacheKey); auto it = m_aStatementsCache.find(cacheKey);
if (it != m_aStatementsCache.end()) { if (it != m_aStatementsCache.end()) {
return new librdf_GraphResult2(it->second); return new librdf_GraphResult2(it->second);
@@ -861,7 +861,7 @@ librdf_NamedGraph::getStatements(
i_xSubject, i_xPredicate, i_xObject, m_xName); i_xSubject, i_xPredicate, i_xObject, m_xName);
{ {
::osl::MutexGuard g(m_CacheMutex); std::unique_lock g(m_CacheMutex);
m_aStatementsCache.emplace(cacheKey, vStatements); m_aStatementsCache.emplace(cacheKey, vStatements);
} }
return new librdf_GraphResult2(vStatements); return new librdf_GraphResult2(vStatements);