diff options
author | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 11:36:01 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2021-08-03 12:20:53 +0200 |
commit | 05ab38359ae72f2a54dc0b5f1b84ac5f649c507a (patch) | |
tree | 5830c7ee2442984e0bc804def7bd95ddd8a25410 /unoxml/source/rdf | |
parent | 5afdcad4c0e7850b18996c549892b9360cd8973f (diff) |
Consolidate on C++17 std::scoped_lock instead of std::lock_guard
as in commit 9376f65a26240441bf9dd6ae1f69886dc9fa60fa
Change-Id: I3ad9afd4d113582a214a4a4bc7eea55e38cd6ff9
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/119927
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'unoxml/source/rdf')
-rw-r--r-- | unoxml/source/rdf/librdf_repository.cxx | 52 |
1 files changed, 26 insertions, 26 deletions
diff --git a/unoxml/source/rdf/librdf_repository.cxx b/unoxml/source/rdf/librdf_repository.cxx index 881fee7636ab..b3854d65a267 100644 --- a/unoxml/source/rdf/librdf_repository.cxx +++ b/unoxml/source/rdf/librdf_repository.cxx @@ -443,7 +443,7 @@ public: virtual ~librdf_GraphResult() override { - std::lock_guard g(m_rMutex); // lock mutex when destroying members + std::scoped_lock g(m_rMutex); // lock mutex when destroying members const_cast<std::shared_ptr<librdf_stream>& >(m_pStream).reset(); const_cast<std::shared_ptr<librdf_node>& >(m_pContext).reset(); const_cast<std::shared_ptr<librdf_query>& >(m_pQuery).reset(); @@ -479,7 +479,7 @@ private: sal_Bool SAL_CALL librdf_GraphResult::hasMoreElements() { - std::lock_guard g(m_rMutex); + std::scoped_lock g(m_rMutex); return m_pStream && !librdf_stream_end(m_pStream.get()); } @@ -501,7 +501,7 @@ librdf_node* librdf_GraphResult::getContext_Lock() const css::uno::Any SAL_CALL librdf_GraphResult::nextElement() { - std::lock_guard g(m_rMutex); + std::scoped_lock g(m_rMutex); if (m_pStream && librdf_stream_end(m_pStream.get())) { throw container::NoSuchElementException(); } @@ -594,7 +594,7 @@ public: virtual ~librdf_QuerySelectResult() override { - std::lock_guard g(m_rMutex); // lock mutex when destroying members + std::scoped_lock g(m_rMutex); // lock mutex when destroying members const_cast<std::shared_ptr<librdf_query_results>& >(m_pQueryResult) .reset(); const_cast<std::shared_ptr<librdf_query>& >(m_pQuery).reset(); @@ -630,7 +630,7 @@ private: sal_Bool SAL_CALL librdf_QuerySelectResult::hasMoreElements() { - std::lock_guard g(m_rMutex); + std::scoped_lock g(m_rMutex); return !librdf_query_results_finished(m_pQueryResult.get()); } @@ -651,7 +651,7 @@ public: css::uno::Any SAL_CALL librdf_QuerySelectResult::nextElement() { - std::lock_guard g(m_rMutex); + std::scoped_lock g(m_rMutex); if (librdf_query_results_finished(m_pQueryResult.get())) { throw container::NoSuchElementException(); } @@ -883,7 +883,7 @@ librdf_Repository::librdf_Repository( { OSL_ENSURE(i_xContext.is(), "librdf_Repository: null context"); - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); if (!m_NumInstances++) { m_pWorld.reset(m_TypeConverter.createWorld_Lock(), safe_librdf_free_world); @@ -892,7 +892,7 @@ librdf_Repository::librdf_Repository( librdf_Repository::~librdf_Repository() { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); // must destroy these before world! m_pModel.reset(); @@ -929,7 +929,7 @@ librdf_Repository::getSupportedServiceNames() // css::rdf::XRepository: uno::Reference< rdf::XBlankNode > SAL_CALL librdf_Repository::createBlankNode() { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); const std::shared_ptr<librdf_node> pNode( librdf_new_node_from_blank_identifier(m_pWorld.get(), nullptr), safe_librdf_free_node); @@ -1001,7 +1001,7 @@ librdf_Repository::importGraph(::sal_Int16 i_Format, // exceptions are propagated i_xInStream->readBytes( buf, static_cast<sal_Int32>( sz ) ); - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked if (m_NamedGraphs.find(contextU) != m_NamedGraphs.end()) { throw container::ElementExistException( @@ -1253,7 +1253,7 @@ librdf_Repository::exportGraph(::sal_Int16 i_Format, uno::Sequence< uno::Reference< rdf::XURI > > SAL_CALL librdf_Repository::getGraphNames() { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); ::std::vector< uno::Reference<rdf::XURI> > ret; std::transform(m_NamedGraphs.begin(), m_NamedGraphs.end(), std::back_inserter(ret), @@ -1271,7 +1271,7 @@ librdf_Repository::getGraph(const uno::Reference< rdf::XURI > & i_xGraphName) } const OUString contextU( i_xGraphName->getStringValue() ); - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); const NamedGraphMap_t::iterator iter( m_NamedGraphs.find(contextU) ); if (iter != m_NamedGraphs.end()) { return iter->second; @@ -1295,7 +1295,7 @@ librdf_Repository::createGraph(const uno::Reference< rdf::XURI > & i_xGraphName) "librdf_Repository::createGraph: URI is reserved", *this, 0); } - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked // NB: librdf does not have a concept of graphs as such; // a librdf named graph exists iff the model contains a statement with @@ -1320,7 +1320,7 @@ librdf_Repository::destroyGraph( } const OUString contextU( i_xGraphName->getStringValue() ); - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked const NamedGraphMap_t::iterator iter( clearGraph_Lock(contextU, false) ); m_NamedGraphs.erase(iter); @@ -1352,7 +1352,7 @@ librdf_Repository::getStatements( librdf_TypeConverter::extractStatement_NoLock( i_xSubject, i_xPredicate, i_xObject)); - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked const std::shared_ptr<librdf_statement> pStatement( librdf_TypeConverter::mkStatement_Lock(m_pWorld.get(), stmt), @@ -1376,7 +1376,7 @@ librdf_Repository::getStatements( uno::Reference< rdf::XQuerySelectResult > SAL_CALL librdf_Repository::querySelect(const OUString & i_rQuery) { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); const OString query( OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) ); const std::shared_ptr<librdf_query> pQuery( @@ -1422,7 +1422,7 @@ librdf_Repository::querySelect(const OUString & i_rQuery) uno::Reference< container::XEnumeration > SAL_CALL librdf_Repository::queryConstruct(const OUString & i_rQuery) { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); const OString query( OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) ); const std::shared_ptr<librdf_query> pQuery( @@ -1458,7 +1458,7 @@ librdf_Repository::queryConstruct(const OUString & i_rQuery) sal_Bool SAL_CALL librdf_Repository::queryAsk(const OUString & i_rQuery) { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); const OString query( OUStringToOString(i_rQuery, RTL_TEXTENCODING_UTF8) ); @@ -1572,7 +1572,7 @@ void SAL_CALL librdf_Repository::setStatementRDFa( removeStatementRDFa(i_xObject); // not atomic with insertion? - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked if (i_rRDFaContent.isEmpty()) { m_RDFaXHTMLContentSet.erase(sXmlId); @@ -1655,7 +1655,7 @@ librdf_Repository::getStatementRDFa( "cannot getStatementsGraph", *this, anyEx); } - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked return beans::Pair< uno::Sequence<rdf::Statement>, sal_Bool >( comphelper::containerToSequence(ret), 0 != m_RDFaXHTMLContentSet.count(sXmlId)); @@ -1700,7 +1700,7 @@ librdf_Repository::getStatementsRDFa( librdf_TypeConverter::extractStatement_NoLock( i_xSubject, i_xPredicate, i_xObject)); - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked const std::shared_ptr<librdf_statement> pStatement( librdf_TypeConverter::mkStatement_Lock(m_pWorld.get(), stmt), @@ -1731,7 +1731,7 @@ librdf_Repository::getStatementsRDFa( void SAL_CALL librdf_Repository::initialize( const uno::Sequence< css::uno::Any > &) { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); // m_pWorld.reset(m_TypeConverter.createWorld(), safe_librdf_free_world); m_pStorage.reset(m_TypeConverter.createStorage_Lock(m_pWorld.get()), @@ -1745,7 +1745,7 @@ NamedGraphMap_t::iterator librdf_Repository::clearGraph_NoLock( // throw (uno::RuntimeException, container::NoSuchElementException, // rdf::RepositoryException) { - std::lock_guard g(m_aMutex); + std::scoped_lock g(m_aMutex); return clearGraph_Lock(i_rGraphName, i_Internal); } @@ -1809,7 +1809,7 @@ void librdf_Repository::addStatementGraph_NoLock( const OUString contextU( i_xGraphName->getStringValue() ); - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked addStatementGraph_Lock(stmt, contextU, false/*i_Internal*/); } @@ -1883,7 +1883,7 @@ void librdf_Repository::removeStatementsGraph_NoLock( i_xSubject, i_xPredicate, i_xObject)); const OUString contextU( i_xGraphName->getStringValue() ); - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked if (m_NamedGraphs.find(contextU) == m_NamedGraphs.end()) { throw container::NoSuchElementException( @@ -1964,7 +1964,7 @@ librdf_Repository::getStatementsGraph_NoLock( i_xSubject, i_xPredicate, i_xObject)); const OUString contextU( i_xGraphName->getStringValue() ); - std::lock_guard g(m_aMutex); // don't call i_x* with mutex locked + std::scoped_lock g(m_aMutex); // don't call i_x* with mutex locked if (!i_Internal && (m_NamedGraphs.find(contextU) == m_NamedGraphs.end())) { throw container::NoSuchElementException( |