diff options
author | Arnaud Versini <arnaud.versini@libreoffice.org> | 2021-10-24 16:49:50 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2022-01-02 18:23:48 +0100 |
commit | 477fa6c3cb92f578032dee60482718efdb8f44f2 (patch) | |
tree | 0a5314a25a4a911a3faac3392668f79b49c40927 /avmedia | |
parent | 5f567b9aec84283546c3084f015d01a70bd76c86 (diff) |
avmedia : use std::mutex instead of osl::Mutex
Change-Id: I0e779db4ef32ac74b9df18d1e162b49236b44b88
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/124122
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'avmedia')
-rw-r--r-- | avmedia/source/gstreamer/gstplayer.cxx | 13 | ||||
-rw-r--r-- | avmedia/source/viewer/mediaevent_impl.cxx | 12 | ||||
-rw-r--r-- | avmedia/source/viewer/mediaevent_impl.hxx | 4 |
3 files changed, 16 insertions, 13 deletions
diff --git a/avmedia/source/gstreamer/gstplayer.cxx b/avmedia/source/gstreamer/gstplayer.cxx index f25ec5c6bb0c..b28be1678207 100644 --- a/avmedia/source/gstreamer/gstplayer.cxx +++ b/avmedia/source/gstreamer/gstplayer.cxx @@ -25,6 +25,7 @@ #include <cstddef> #include <cstring> #include <map> +#include <mutex> #include <set> #include <vector> #include <math.h> @@ -94,7 +95,7 @@ private: DECL_STATIC_LINK(MissingPluginInstaller, launchUi, void*, void); - osl::Mutex mutex_; + std::mutex mutex_; std::set<OString> reported_; std::map<OString, std::set<rtl::Reference<Player>>> queued_; rtl::Reference<MissingPluginInstallerThread> currentThread_; @@ -106,7 +107,7 @@ private: MissingPluginInstaller::~MissingPluginInstaller() { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); SAL_WARN_IF(currentThread_.is(), "avmedia.gstreamer", "unjoined thread"); inCleanUp_ = true; } @@ -134,7 +135,7 @@ void MissingPluginInstaller::report( rtl::Reference<MissingPluginInstallerThread> join; rtl::Reference<MissingPluginInstallerThread> launch; { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); if (reported_.find(detStr) != reported_.end()) { return; } @@ -179,7 +180,7 @@ void eraseSource(std::set<rtl::Reference<Player>> & set, Player const * source) void MissingPluginInstaller::detach(Player const * source) { rtl::Reference<MissingPluginInstallerThread> join; { - osl::MutexGuard g(mutex_); + std::unique_lock g(mutex_); if (inCleanUp_) { // Guard against ~MissingPluginInstaller with erroneously un-joined // currentThread_ (thus non-empty currentSources_) calling @@ -251,7 +252,7 @@ void MissingPluginInstallerThread::execute() { for (;;) { std::vector<OString> details; { - osl::MutexGuard g(inst.mutex_); + std::unique_lock g(inst.mutex_); assert(!inst.currentDetails_.empty()); details.swap(inst.currentDetails_); } @@ -264,7 +265,7 @@ void MissingPluginInstallerThread::execute() { args.push_back(nullptr); gst_install_plugins_sync(args.data(), nullptr); { - osl::MutexGuard g(inst.mutex_); + std::unique_lock g(inst.mutex_); if (inst.queued_.empty() || inst.launchNewThread_) { inst.launchNewThread_ = true; break; diff --git a/avmedia/source/viewer/mediaevent_impl.cxx b/avmedia/source/viewer/mediaevent_impl.cxx index 62217f6d9473..d6a2c082c246 100644 --- a/avmedia/source/viewer/mediaevent_impl.cxx +++ b/avmedia/source/viewer/mediaevent_impl.cxx @@ -52,7 +52,7 @@ void SAL_CALL MediaEventListenersImpl::disposing( const css::lang::EventObject& void SAL_CALL MediaEventListenersImpl::keyPressed( const css::awt::KeyEvent& e ) { - const ::osl::MutexGuard aGuard( maMutex ); + const std::unique_lock aGuard( maMutex ); if( mpNotifyWindow ) { @@ -69,7 +69,7 @@ void SAL_CALL MediaEventListenersImpl::keyPressed( const css::awt::KeyEvent& e ) void SAL_CALL MediaEventListenersImpl::keyReleased( const css::awt::KeyEvent& e ) { - const ::osl::MutexGuard aGuard( maMutex ); + const std::unique_lock aGuard( maMutex ); if( mpNotifyWindow ) { @@ -85,7 +85,7 @@ void SAL_CALL MediaEventListenersImpl::keyReleased( const css::awt::KeyEvent& e void SAL_CALL MediaEventListenersImpl::mousePressed( const css::awt::MouseEvent& e ) { - const ::osl::MutexGuard aGuard( maMutex ); + const std::unique_lock aGuard( maMutex ); if( mpNotifyWindow ) { @@ -103,7 +103,7 @@ void SAL_CALL MediaEventListenersImpl::mousePressed( const css::awt::MouseEvent& void SAL_CALL MediaEventListenersImpl::mouseReleased( const css::awt::MouseEvent& e ) { - const ::osl::MutexGuard aGuard( maMutex ); + const std::unique_lock aGuard( maMutex ); const SolarMutexGuard aAppGuard; if( mpNotifyWindow ) @@ -132,7 +132,7 @@ void SAL_CALL MediaEventListenersImpl::mouseExited( const css::awt::MouseEvent& void SAL_CALL MediaEventListenersImpl::mouseDragged( const css::awt::MouseEvent& e ) { - const ::osl::MutexGuard aGuard( maMutex ); + const std::unique_lock aGuard( maMutex ); if( mpNotifyWindow ) { @@ -144,7 +144,7 @@ void SAL_CALL MediaEventListenersImpl::mouseDragged( const css::awt::MouseEvent& void SAL_CALL MediaEventListenersImpl::mouseMoved( const css::awt::MouseEvent& e ) { - const ::osl::MutexGuard aGuard( maMutex ); + const std::unique_lock aGuard( maMutex ); if( mpNotifyWindow ) { diff --git a/avmedia/source/viewer/mediaevent_impl.hxx b/avmedia/source/viewer/mediaevent_impl.hxx index 1dc1c20ec2ff..682eff1d7970 100644 --- a/avmedia/source/viewer/mediaevent_impl.hxx +++ b/avmedia/source/viewer/mediaevent_impl.hxx @@ -27,6 +27,8 @@ #include <com/sun/star/awt/XFocusListener.hpp> #include <vcl/vclptr.hxx> +#include <mutex> + namespace avmedia::priv { @@ -68,7 +70,7 @@ namespace avmedia::priv private: VclPtr<vcl::Window> mpNotifyWindow; - mutable ::osl::Mutex maMutex; + mutable std::mutex maMutex; }; } |