Kaydet (Commit) d27e3eca authored tarafından Gurkaran's avatar Gurkaran Kaydeden (comit) Noel Grandin

tdf#84323: Make osl::Condition::wait more readable

It is to improve the readability of calls to osl::Condition::wait.

Change-Id: I5945343c5a7e4729ab599380414d18280bd176fe
Signed-off-by: 's avatarGurkaran <gurkran@gmail.com>
Reviewed-on: https://gerrit.libreoffice.org/23417Tested-by: 's avatarJenkins <ci@libreoffice.org>
Reviewed-by: 's avatarNoel Grandin <noelgrandin@gmail.com>
üst 9e7447d3
......@@ -20,6 +20,7 @@
#include "sal/config.h"
#include <cassert>
#include <chrono>
#include <algorithm>
#include <unordered_map>
......@@ -148,8 +149,7 @@ namespace cppu_threadpool
}
// let the thread wait 2 seconds
TimeValue time = { 2 , 0 };
waitingThread.condition.wait( &time );
waitingThread.condition.wait( std::chrono::seconds(2) );
{
MutexGuard guard ( m_mutexWaitingThreadList );
......
......@@ -18,6 +18,7 @@
*/
#include <sal/types.h>
#include <chrono>
#include "boost/noncopyable.hpp"
#include "com/sun/star/awt/AsyncCallback.hpp"
#include "com/sun/star/awt/XCallback.hpp"
......@@ -177,8 +178,7 @@ void Test::test() {
css::uno::Any());
// Wait for result.condition or connection_ going stale:
for (;;) {
TimeValue delay = { 1, 0 }; // 1 sec
osl::Condition::Result res = result.condition.wait(&delay);
osl::Condition::Result res = result.condition.wait(std::chrono::seconds(1)); // 1 sec delay
if (res == osl::Condition::result_ok) {
break;
}
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment