diff options
author | Kevin Dubrulle <kevin.dubrulle@gmail.com> | 2018-07-07 13:34:20 +0200 |
---|---|---|
committer | Noel Grandin <noel.grandin@collabora.co.uk> | 2018-07-08 11:48:40 +0200 |
commit | d0f44d8ba7e87aa263008d3cfc4e68294d783162 (patch) | |
tree | 8527c62fb066366df2b40386c6544e670aa10a1a /vcl | |
parent | a2193f8f33565cc896592acb9d3ab65c756d97fb (diff) |
tdf#84323 - sal - add sane sleep interface: cleanup osl_waitThread
Replace osl_waitThread by osl::Thread::wait.
Use std::chrono instead of TimeValue.
Change-Id: I71691d014feeeb0c5d0ba29d048bda8e25e6e7dd
Reviewed-on: https://gerrit.libreoffice.org/57130
Tested-by: Jenkins
Reviewed-by: Noel Grandin <noel.grandin@collabora.co.uk>
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/unx/generic/dtrans/X11_selection.cxx | 11 | ||||
-rw-r--r-- | vcl/workben/vcldemo.cxx | 19 |
2 files changed, 10 insertions, 20 deletions
diff --git a/vcl/unx/generic/dtrans/X11_selection.cxx b/vcl/unx/generic/dtrans/X11_selection.cxx index 7096c0c59c8d..43f0d228002c 100644 --- a/vcl/unx/generic/dtrans/X11_selection.cxx +++ b/vcl/unx/generic/dtrans/X11_selection.cxx @@ -943,11 +943,7 @@ bool SelectionManager::getPasteData( Atom selection, Atom type, Sequence< sal_In } else { - TimeValue aTVal; - aTVal.Seconds = 0; - aTVal.Nanosec = 100000000; - aGuard.clear(); - osl_waitThread( &aTVal ); + osl::Thread::wait(std::chrono::milliseconds(100)); aGuard.reset(); } if( bHandle ) @@ -3369,15 +3365,12 @@ void SelectionManager::dragDoDispatch() #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "begin executeDrag dispatching\n" ); #endif - TimeValue aTVal; - aTVal.Seconds = 0; - aTVal.Nanosec = 200000000; oslThread aThread = m_aDragExecuteThread; while( m_xDragSourceListener.is() && ( ! m_bDropSent || time(nullptr)-m_nDropTimeout < 5 ) && osl_scheduleThread( aThread ) ) { // let the thread in the run method do the dispatching // just look occasionally here whether drop timed out or is completed - osl_waitThread( &aTVal ); + osl::Thread::wait(std::chrono::milliseconds(200)); } #if OSL_DEBUG_LEVEL > 1 fprintf( stderr, "end executeDrag dispatching\n" ); diff --git a/vcl/workben/vcldemo.cxx b/vcl/workben/vcldemo.cxx index 0df08ad41176..4cac3e072ab7 100644 --- a/vcl/workben/vcldemo.cxx +++ b/vcl/workben/vcldemo.cxx @@ -1716,14 +1716,13 @@ class DemoWin : public WorkWindow class RenderThread : public salhelper::Thread { DemoWin &mrWin; - TimeValue maDelay; + sal_uInt32 mnDelaySecs = 0; public: RenderThread(DemoWin &rWin, sal_uInt32 nDelaySecs) : Thread("vcldemo render thread") , mrWin(rWin) + , mnDelaySecs(nDelaySecs) { - maDelay.Seconds = nDelaySecs; - maDelay.Nanosec = 0; launch(); } virtual ~RenderThread() override @@ -1732,7 +1731,7 @@ class DemoWin : public WorkWindow } virtual void execute() override { - osl_waitThread(&maDelay); + wait(std::chrono::seconds(mnDelaySecs)); SolarMutexGuard aGuard; fprintf (stderr, "render from a different thread\n"); @@ -1933,20 +1932,18 @@ public: IMPL_LINK_NOARG(DemoWidgets, GLTestClick, Button*, void) { sal_Int32 nSelected = mpGLCombo->GetSelectedEntryPos(); + sal_uInt32 nDelaySeconds = 0; - TimeValue aDelay; - aDelay.Seconds = 0; - aDelay.Nanosec = 0; switch (nSelected) { case 0: - aDelay.Seconds = 1; + nDelaySeconds = 1; break; case 1: - aDelay.Seconds = 3; + nDelaySeconds = 3; break; case 2: - aDelay.Seconds = 7; + nDelaySeconds = 7; break; default: break; @@ -1956,7 +1953,7 @@ IMPL_LINK_NOARG(DemoWidgets, GLTestClick, Button*, void) if (bEnterLeave) OpenGLZoneTest::enter(); - osl_waitThread(&aDelay); + osl::Thread::wait(std::chrono::seconds(nDelaySeconds)); if (bEnterLeave) OpenGLZoneTest::leave(); |