sc/source/ui/dataprovider/csvdataprovider.cxx | 6 ++---- sc/source/ui/docshell/datastream.cxx | 10 ++++------ sc/source/ui/inc/dataprovider.hxx | 4 ++-- 3 files changed, 8 insertions(+), 12 deletions(-)
New commits: commit 18f14b9e50407e4c0b97024c122f8ce7c0efaad4 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 2 09:37:42 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Feb 5 09:54:17 2023 +0000 osl::Mutex->std::atomic in sc::CSVFetchThread Change-Id: I615be595b73f4d55f13f7245b06783f6af03d58a Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146557 Tested-by: Jenkins Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk> diff --git a/sc/source/ui/dataprovider/csvdataprovider.cxx b/sc/source/ui/dataprovider/csvdataprovider.cxx index c6e4c15dee6b..99533c9f7a6b 100644 --- a/sc/source/ui/dataprovider/csvdataprovider.cxx +++ b/sc/source/ui/dataprovider/csvdataprovider.cxx @@ -84,14 +84,12 @@ CSVFetchThread::~CSVFetchThread() bool CSVFetchThread::IsRequestedTerminate() { - osl::MutexGuard aGuard(maMtxTerminate); - return mbTerminate; + return mbTerminate.load(); } void CSVFetchThread::RequestTerminate() { - osl::MutexGuard aGuard(maMtxTerminate); - mbTerminate = true; + mbTerminate.store(true); } void CSVFetchThread::EndThread() diff --git a/sc/source/ui/inc/dataprovider.hxx b/sc/source/ui/inc/dataprovider.hxx index e053a72eb4e2..680bf3819390 100644 --- a/sc/source/ui/inc/dataprovider.hxx +++ b/sc/source/ui/inc/dataprovider.hxx @@ -19,6 +19,7 @@ #include <rtl/strbuf.hxx> +#include <atomic> #include <vector> //#include <map> @@ -37,8 +38,7 @@ class CSVFetchThread : public salhelper::Thread ScDocument& mrDocument; OUString maURL; - bool mbTerminate; - osl::Mutex maMtxTerminate; + std::atomic<bool> mbTerminate; orcus::csv::parser_config maConfig; commit 640202f5248de274b83356e963b0e1a2e405aa18 Author: Noel Grandin <noel.gran...@collabora.co.uk> AuthorDate: Thu Feb 2 09:36:17 2023 +0200 Commit: Noel Grandin <noel.gran...@collabora.co.uk> CommitDate: Sun Feb 5 09:54:04 2023 +0000 osl::Mutex->std::atomic in sc::ReaderThread Change-Id: I10296bb29fc59475f0e3b13c06da97e703485792 Reviewed-on: https://gerrit.libreoffice.org/c/core/+/146556 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 edd3aeaf26cd..dad99bba0e30 100644 --- a/sc/source/ui/docshell/datastream.cxx +++ b/sc/source/ui/docshell/datastream.cxx @@ -28,6 +28,7 @@ #include <orcus/csv_parser.hpp> +#include <atomic> #include <queue> namespace com::sun::star::ui { class XUIElement; } @@ -96,8 +97,7 @@ class ReaderThread : public salhelper::Thread { std::unique_ptr<SvStream> mpStream; size_t mnColCount; - bool mbTerminate; - osl::Mutex maMtxTerminate; + std::atomic<bool> mbTerminate; std::queue<std::unique_ptr<DataStream::LinesType>> maPendingLines; std::queue<std::unique_ptr<DataStream::LinesType>> maUsedLines; @@ -122,14 +122,12 @@ public: bool isTerminateRequested() { - osl::MutexGuard aGuard(maMtxTerminate); - return mbTerminate; + return mbTerminate.load(); } void requestTerminate() { - osl::MutexGuard aGuard(maMtxTerminate); - mbTerminate = true; + mbTerminate.store(true); } void endThread()