diff options
author | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-03-18 18:32:13 +1100 |
---|---|---|
committer | Chris Sherlock <chris.sherlock79@gmail.com> | 2017-03-18 08:24:25 +0000 |
commit | 396138719206d5033faaeaf09b88437cbb3480e7 (patch) | |
tree | 7c9741171c3b35cfdee628c68f280e38b0b9d223 /salhelper | |
parent | 5ec1713ae5b177ae32970c7209cea55ee0041c5c (diff) |
salhelper: change oslCondition to osl::Condition
Condition is deprecated already, but there is no need for the
us to use the low-level C-API, when in fact there is a C++ fascade
that calls on this via the C++ abstraction, osl::Condition.
This will make it much easier to switch to using std::condition_variable
Change-Id: Ia362666ff241293e143de0fa1dc0bc3a990bef82
Reviewed-on: https://gerrit.libreoffice.org/35388
Reviewed-by: Chris Sherlock <chris.sherlock79@gmail.com>
Tested-by: Chris Sherlock <chris.sherlock79@gmail.com>
Diffstat (limited to 'salhelper')
-rw-r--r-- | salhelper/source/condition.cxx | 17 |
1 files changed, 8 insertions, 9 deletions
diff --git a/salhelper/source/condition.cxx b/salhelper/source/condition.cxx index 61971def7509..1122fe8b32ff 100644 --- a/salhelper/source/condition.cxx +++ b/salhelper/source/condition.cxx @@ -33,14 +33,13 @@ using namespace salhelper; Condition::Condition(osl::Mutex& aMutex) : m_aMutex(aMutex), - m_aCondition(osl_createCondition()) + m_aCondition() { } Condition::~Condition() { - osl_destroyCondition(m_aCondition); } @@ -60,7 +59,7 @@ ConditionModifier::ConditionModifier(Condition& aCond) ConditionModifier::~ConditionModifier() { if(m_aCond.applies()) - osl_setCondition(m_aCond.m_aCondition); + m_aCond.m_aCondition.set(); m_aCond.m_aMutex.release(); } @@ -85,13 +84,13 @@ ConditionWaiter::ConditionWaiter(Condition& aCond) : m_aCond(aCond) { while(true) { - osl_waitCondition(m_aCond.m_aCondition,nullptr); + m_aCond.m_aCondition.wait(); m_aCond.m_aMutex.acquire(); if(m_aCond.applies()) break; else { - osl_resetCondition(m_aCond.m_aCondition); + m_aCond.m_aCondition.reset(); m_aCond.m_aMutex.release(); } } @@ -106,8 +105,8 @@ ConditionWaiter::ConditionWaiter(Condition& aCond,sal_uInt32 milliSec) aTime.Nanosec = 1000000 * ( milliSec % 1000 ); while(true) { - if( osl_waitCondition(m_aCond.m_aCondition,&aTime) == - osl_cond_result_timeout ) + if( m_aCond.m_aCondition.wait(&aTime) == + osl::Condition::result_timeout ) throw timedout(); m_aCond.m_aMutex.acquire(); @@ -115,7 +114,7 @@ ConditionWaiter::ConditionWaiter(Condition& aCond,sal_uInt32 milliSec) if(m_aCond.applies()) break; else { - osl_resetCondition(m_aCond.m_aCondition); + m_aCond.m_aCondition.reset(); m_aCond.m_aMutex.release(); } } @@ -125,7 +124,7 @@ ConditionWaiter::ConditionWaiter(Condition& aCond,sal_uInt32 milliSec) ConditionWaiter::~ConditionWaiter() { if(! m_aCond.applies()) - osl_resetCondition(m_aCond.m_aCondition); + m_aCond.m_aCondition.reset(); m_aCond.m_aMutex.release(); } |