slideshow/source/engine/eventqueue.cxx |   20 ++++++++++----------
 slideshow/source/inc/eventqueue.hxx    |    4 ++--
 2 files changed, 12 insertions(+), 12 deletions(-)

New commits:
commit 9974ed792a1141fe3c3dc0a1ec5255a23e76f27b
Author:     Noel Grandin <noelgran...@gmail.com>
AuthorDate: Sat May 7 21:15:36 2022 +0200
Commit:     Noel Grandin <noel.gran...@collabora.co.uk>
CommitDate: Sun May 8 16:38:52 2022 +0200

    osl::Mutex->std::mutex in slideshow::EventQueue
    
    Change-Id: Ie9e53e5dc2c842e11457846b5f177fc55683e0d4
    Reviewed-on: https://gerrit.libreoffice.org/c/core/+/134016
    Tested-by: Jenkins
    Reviewed-by: Noel Grandin <noel.gran...@collabora.co.uk>

diff --git a/slideshow/source/engine/eventqueue.cxx 
b/slideshow/source/engine/eventqueue.cxx
index 6094fa43bf89..b63db471d5ef 100644
--- a/slideshow/source/engine/eventqueue.cxx
+++ b/slideshow/source/engine/eventqueue.cxx
@@ -77,7 +77,7 @@ namespace slideshow::internal
 
         bool EventQueue::addEvent( const EventSharedPtr& rEvent )
         {
-            ::osl::MutexGuard aGuard( maMutex );
+            std::unique_lock aGuard( maMutex );
 
             SAL_INFO("slideshow.eventqueue", "adding event \"" << 
rEvent->GetDescription()
                 << "\" [" << rEvent.get()
@@ -103,7 +103,7 @@ namespace slideshow::internal
 
         bool EventQueue::addEventForNextRound( EventSharedPtr const& rEvent )
         {
-            ::osl::MutexGuard aGuard( maMutex );
+            std::unique_lock aGuard( maMutex );
 
             SAL_INFO("slideshow.eventqueue", "adding event \"" << 
rEvent->GetDescription()
                 << "\" [" << rEvent.get()
@@ -120,7 +120,7 @@ namespace slideshow::internal
 
         bool EventQueue::addEventWhenQueueIsEmpty (const EventSharedPtr& 
rpEvent)
         {
-            ::osl::MutexGuard aGuard( maMutex );
+            std::unique_lock aGuard( maMutex );
 
             SAL_INFO("slideshow.eventqueue", "adding event \"" << 
rpEvent->GetDescription()
                 << "\" [" << rpEvent.get()
@@ -140,20 +140,18 @@ namespace slideshow::internal
 
         void EventQueue::forceEmpty()
         {
-            ::osl::MutexGuard aGuard( maMutex );
-
             process_(true);
         }
 
         void EventQueue::process()
         {
-            ::osl::MutexGuard aGuard( maMutex );
-
             process_(false);
         }
 
         void EventQueue::process_( bool bFireAllEvents )
         {
+            std::unique_lock aGuard( maMutex );
+
             SAL_INFO("slideshow.verbose", "EventQueue: heartbeat" );
 
             // add in all that have been added explicitly for this round:
@@ -197,6 +195,7 @@ namespace slideshow::internal
                 // the need to prune queues of those inactive shells.
                 if( event.pEvent->isCharged() )
                 {
+                    aGuard.unlock();
                     try
                     {
                         SAL_INFO("slideshow.eventqueue", "firing event \""
@@ -243,6 +242,7 @@ namespace slideshow::internal
                         // still better let our clients now...
                         SAL_WARN("slideshow.eventqueue", 
"::presentation::internal::EventQueue: Event threw a SlideShowException, action 
might not have been fully performed" );
                     }
+                    aGuard.lock();
                 }
                 else
                 {
@@ -257,14 +257,14 @@ namespace slideshow::internal
 
         bool EventQueue::isEmpty() const
         {
-            ::osl::MutexGuard aGuard( maMutex );
+            std::unique_lock aGuard( maMutex );
 
             return maEvents.empty() && maNextEvents.empty() && 
maNextNextEvents.empty();
         }
 
         double EventQueue::nextTimeout() const
         {
-            ::osl::MutexGuard aGuard( maMutex );
+            std::unique_lock aGuard( maMutex );
 
             // return time for next entry (if any)
             double nTimeout (::std::numeric_limits<double>::max());
@@ -281,7 +281,7 @@ namespace slideshow::internal
 
         void EventQueue::clear()
         {
-            ::osl::MutexGuard aGuard( maMutex );
+            std::unique_lock aGuard( maMutex );
 
             // TODO(P1): Maybe a plain vector and vector.swap will
             // be faster here. Profile.
diff --git a/slideshow/source/inc/eventqueue.hxx 
b/slideshow/source/inc/eventqueue.hxx
index 63c93f7a302d..fb0f1b8536eb 100644
--- a/slideshow/source/inc/eventqueue.hxx
+++ b/slideshow/source/inc/eventqueue.hxx
@@ -21,10 +21,10 @@
 #define INCLUDED_SLIDESHOW_SOURCE_INC_EVENTQUEUE_HXX
 
 #include <canvas/elapsedtime.hxx>
-#include <osl/mutex.hxx>
 
 #include "event.hxx"
 
+#include <mutex>
 #include <queue>
 #include <vector>
 
@@ -116,7 +116,7 @@ namespace slideshow::internal
             getTimer() const { return mpTimer; }
 
         private:
-            mutable ::osl::Mutex      maMutex;
+            mutable std::mutex      maMutex;
 
             struct EventEntry
             {

Reply via email to