sc/source/ui/docshell/datastream.cxx | 22 +++++++++++----------- 1 file changed, 11 insertions(+), 11 deletions(-)
New commits: commit 4d05f115518615d957bf8cfde15fc61facd28cec Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Tue Feb 14 10:29:06 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Tue Feb 14 12:35:25 2023 +0000 osl::Mutex->std::mutex in datastreams::ReaderThread Change-Id: I4851fca7e9f4433bda79b86a0d5cc7842ff45bd3 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146994 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/docshell/datastream.cxx b/sc/source/ui/docshell/datastream.cxx index dad99bba0e30..f6669e3265f9 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -101,7 +101,7 @@ class ReaderThread : public salhelper::Thread std::queue<std::unique_ptr<DataStream::LinesType>> maPendingLines; std::queue<std::unique_ptr<DataStream::LinesType>> maUsedLines; - osl::Mutex maMtxLines; + std::mutex maMtxLines; osl::Condition maCondReadStream; osl::Condition maCondConsume; @@ -165,7 +165,7 @@ public: maUsedLines.push(std::move(pLines)); } - osl::Mutex& getLinesMutex() + std::mutex& getLinesMutex() { return maMtxLines; } @@ -176,18 +176,18 @@ private: while (!isTerminateRequested()) { std::unique_ptr<DataStream::LinesType> pLines; - osl::ResettableMutexGuard aGuard(maMtxLines); + std::unique_lock aGuard(maMtxLines); if (!maUsedLines.empty()) { // Re-use lines from previous runs. pLines = std::move(maUsedLines.front()); maUsedLines.pop(); - aGuard.clear(); // unlock + aGuard.unlock(); // unlock } else { - aGuard.clear(); // unlock + aGuard.unlock(); // unlock pLines.reset(new DataStream::LinesType(10)); } @@ -201,14 +201,14 @@ private: parser.parse(); } - aGuard.reset(); // lock + aGuard.lock(); // lock while (!isTerminateRequested() && maPendingLines.size() >= 8) { // pause reading for a bit - aGuard.clear(); // unlock + aGuard.unlock(); // unlock maCondReadStream.wait(); maCondReadStream.reset(); - aGuard.reset(); // lock + aGuard.lock(); // lock } maPendingLines.push(std::move(pLines)); maCondConsume.set(); @@ -316,15 +316,15 @@ DataStream::Line DataStream::ConsumeLine() if (mxReaderThread->isTerminateRequested()) return Line(); - osl::ResettableMutexGuard aGuard(mxReaderThread->getLinesMutex()); + std::unique_lock aGuard(mxReaderThread->getLinesMutex()); if (mpLines) mxReaderThread->pushUsedLines(std::move(mpLines)); while (!mxReaderThread->hasNewLines()) { - aGuard.clear(); // unlock + aGuard.unlock(); // unlock mxReaderThread->waitForNewLines(); - aGuard.reset(); // lock + aGuard.lock(); // lock } mpLines = mxReaderThread->popNewLines();