diff options
-rw-r--r-- | include/vcl/threadex.hxx | 6 | ||||
-rw-r--r-- | vcl/source/helper/threadex.cxx | 26 |
2 files changed, 16 insertions, 16 deletions
diff --git a/include/vcl/threadex.hxx b/include/vcl/threadex.hxx index 076974b0721e..6330a71bcc28 100644 --- a/include/vcl/threadex.hxx +++ b/include/vcl/threadex.hxx @@ -20,7 +20,7 @@ #ifndef INCLUDED_VCL_THREADEX_HXX #define INCLUDED_VCL_THREADEX_HXX -#include <osl/conditn.h> +#include <osl/conditn.hxx> #include <osl/thread.h> #include <tools/link.hxx> #include <vcl/dllapi.h> @@ -33,8 +33,8 @@ namespace vcl { class VCL_DLLPUBLIC SolarThreadExecutor { - oslCondition m_aStart; - oslCondition m_aFinish; + osl::Condition m_aStart; + osl::Condition m_aFinish; long m_nReturn; bool m_bTimeout; diff --git a/vcl/source/helper/threadex.cxx b/vcl/source/helper/threadex.cxx index 24b418e50702..7bc04082ab71 100644 --- a/vcl/source/helper/threadex.cxx +++ b/vcl/source/helper/threadex.cxx @@ -23,26 +23,24 @@ using namespace vcl; SolarThreadExecutor::SolarThreadExecutor() - :m_nReturn( 0 ) + :m_aStart() + ,m_aFinish() + ,m_nReturn( 0 ) ,m_bTimeout( false ) { - m_aStart = osl_createCondition(); - m_aFinish = osl_createCondition(); } SolarThreadExecutor::~SolarThreadExecutor() { - osl_destroyCondition( m_aStart ); - osl_destroyCondition( m_aFinish ); } IMPL_LINK_NOARG(SolarThreadExecutor, worker, void*, void) { if ( !m_bTimeout ) { - osl_setCondition( m_aStart ); + m_aStart.set(); m_nReturn = doIt(); - osl_setCondition( m_aFinish ); + m_aFinish.set(); } } @@ -50,23 +48,25 @@ void SolarThreadExecutor::execute() { if( ::osl::Thread::getCurrentIdentifier() == Application::GetMainThreadIdentifier() ) { - osl_setCondition( m_aStart ); + m_aStart.set(); m_nReturn = doIt(); - osl_setCondition( m_aFinish ); + m_aFinish.set(); } else { - osl_resetCondition( m_aStart ); - osl_resetCondition( m_aFinish ); + m_aStart.reset(); + m_aFinish.reset(); SolarMutexReleaser aReleaser; ImplSVEvent * nEvent = Application::PostUserEvent( LINK( this, SolarThreadExecutor, worker ) ); - if ( osl_cond_result_timeout == osl_waitCondition( m_aStart, nullptr ) ) + if (m_aStart.wait() == osl::Condition::result_timeout) { m_bTimeout = true; Application::RemoveUserEvent( nEvent ); } else - osl_waitCondition( m_aFinish, nullptr ); + { + m_aFinish.wait(); + } } } |