diff options
Diffstat (limited to 'vcl')
-rw-r--r-- | vcl/source/helper/threadex.cxx | 26 |
1 files changed, 13 insertions, 13 deletions
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(); + } } } |