From 090c280e343911824bb48660b0d5af3399519624 Mon Sep 17 00:00:00 2001 From: Edouard DUPIN Date: Thu, 13 Oct 2016 21:29:18 +0200 Subject: [PATCH] [DEV] remove dependency of unistd.h --- test/client/appl/main.cpp | 4 ++-- test/service1/appl/main.cpp | 4 ++-- tools/picture/appl/main.cpp | 6 +++--- tools/system-gateway/appl/ClientInterface.cpp | 2 +- tools/system-gateway/appl/main.cpp | 4 ++-- tools/system-user/appl/main.cpp | 6 +++--- zeus/Client.cpp | 2 +- zeus/Client.hpp | 2 +- zeus/Future.cpp | 2 +- zeus/FutureBase.cpp | 8 ++++---- zeus/Service.cpp | 2 +- zeus/WebServer.cpp | 6 +++--- 12 files changed, 24 insertions(+), 24 deletions(-) diff --git a/test/client/appl/main.cpp b/test/client/appl/main.cpp index d3cdca0..ef04d11 100644 --- a/test/client/appl/main.cpp +++ b/test/client/appl/main.cpp @@ -11,7 +11,7 @@ #include #include #include -#include + #include @@ -194,7 +194,7 @@ int main(int _argc, const char *_argv[]) { } int32_t iii=0; while (iii < 3) { - usleep(500000); + std::this_thread::sleep_for(std::chrono::milliseconds(500)); APPL_INFO("Appl in waiting ... " << iii << "/3"); iii++; } diff --git a/test/service1/appl/main.cpp b/test/service1/appl/main.cpp index ca40c9d..1d4b5fc 100644 --- a/test/service1/appl/main.cpp +++ b/test/service1/appl/main.cpp @@ -8,7 +8,7 @@ #include #include #include -#include + #include namespace appl { @@ -105,7 +105,7 @@ int main(int _argc, const char *_argv[]) { serviceInterface.connect(); int32_t iii=0; while (true) { - usleep(1000000); + std::this_thread::sleep_for(std::chrono::milliseconds(1000)); serviceInterface.pingIsAlive(); APPL_INFO("service in waiting ... " << iii << "/inf"); iii++; diff --git a/tools/picture/appl/main.cpp b/tools/picture/appl/main.cpp index ceb17b1..c2ec14b 100644 --- a/tools/picture/appl/main.cpp +++ b/tools/picture/appl/main.cpp @@ -9,7 +9,7 @@ #include #include #include -#include + #include #include #include @@ -430,12 +430,12 @@ int main(int _argc, const char *_argv[]) { APPL_INFO("== ZEUS service: " << *serviceInterface.propertyNameService << " [STOP] Can not connect to the GateWay"); APPL_INFO("==========================================================="); APPL_INFO("wait 5 second ..."); - usleep(5000000); + std::this_thread::sleep_for(std::chrono::seconds(5)); continue; } int32_t iii=0; while (serviceInterface.GateWayAlive() == true) { - usleep(1000000); + std::this_thread::sleep_for(std::chrono::seconds(1)); serviceInterface.pingIsAlive(); /* serviceInterface.store(); diff --git a/tools/system-gateway/appl/ClientInterface.cpp b/tools/system-gateway/appl/ClientInterface.cpp index f4da77d..0f4666a 100644 --- a/tools/system-gateway/appl/ClientInterface.cpp +++ b/tools/system-gateway/appl/ClientInterface.cpp @@ -8,7 +8,7 @@ #include #include #include -#include + #include diff --git a/tools/system-gateway/appl/main.cpp b/tools/system-gateway/appl/main.cpp index 8384d2a..6901e52 100644 --- a/tools/system-gateway/appl/main.cpp +++ b/tools/system-gateway/appl/main.cpp @@ -8,7 +8,7 @@ #include #include #include -#include + #include @@ -48,7 +48,7 @@ int main(int _argc, const char *_argv[]) { APPL_INFO("=================================="); basicGateway.start(); while (true) { - usleep(100000); + std::this_thread::sleep_for(std::chrono::milliseconds(100)); basicGateway.cleanIO(); } basicGateway.stop(); diff --git a/tools/system-user/appl/main.cpp b/tools/system-user/appl/main.cpp index deed1c6..8fe0416 100644 --- a/tools/system-user/appl/main.cpp +++ b/tools/system-user/appl/main.cpp @@ -8,7 +8,7 @@ #include #include #include -#include + #include #include @@ -244,12 +244,12 @@ int main(int _argc, const char *_argv[]) { APPL_INFO("== ZEUS service: " << *serviceInterface.propertyNameService << " [STOP] Can not connect to the GateWay"); APPL_INFO("==========================================================="); APPL_INFO("wait 5 second ..."); - usleep(5000000); + std::this_thread::sleep_for(std::chrono::seconds(5)); continue; } int32_t iii=0; while (serviceInterface.GateWayAlive() == true) { - usleep(1000000); + std::this_thread::sleep_for(std::chrono::seconds(10)); serviceInterface.pingIsAlive(); APPL_INFO("service in waiting ... " << iii << "/inf"); iii++; diff --git a/zeus/Client.cpp b/zeus/Client.cpp index 9ebd7a1..c4e962c 100644 --- a/zeus/Client.cpp +++ b/zeus/Client.cpp @@ -8,7 +8,7 @@ #include #include -#include + zeus::Client::Client() : propertyIp(this, "ip", "127.0.0.1", "Ip to connect server", &zeus::Client::onPropertyChangeIp), diff --git a/zeus/Client.hpp b/zeus/Client.hpp index 38af368..dea39e3 100644 --- a/zeus/Client.hpp +++ b/zeus/Client.hpp @@ -9,7 +9,7 @@ #include #include #include -#include + #include #include diff --git a/zeus/Future.cpp b/zeus/Future.cpp index a5b5aa7..0286e84 100644 --- a/zeus/Future.cpp +++ b/zeus/Future.cpp @@ -6,7 +6,7 @@ #include #include #include -#include + #include namespace zeus { diff --git a/zeus/FutureBase.cpp b/zeus/FutureBase.cpp index 20ce268..6b27695 100644 --- a/zeus/FutureBase.cpp +++ b/zeus/FutureBase.cpp @@ -6,7 +6,7 @@ #include #include #include -#include + zeus::FutureBase::FutureBase(const zeus::FutureBase& _base): m_data(_base.m_data) { @@ -172,7 +172,7 @@ bool zeus::FutureBase::isFinished() const { const zeus::FutureBase& zeus::FutureBase::wait() const { while (isFinished() == false) { // TODO : Do it better ... like messaging/mutex_locked ... - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } return *this; } @@ -182,7 +182,7 @@ const zeus::FutureBase& zeus::FutureBase::waitFor(std::chrono::microseconds _del while ( std::chrono::steady_clock::now() - start < _delta && isFinished() == false) { // TODO : Do it better ... like messaging/mutex_locked ... - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); start = std::chrono::steady_clock::now(); } return *this; @@ -192,7 +192,7 @@ const zeus::FutureBase& zeus::FutureBase::waitUntil(std::chrono::steady_clock::t while ( std::chrono::steady_clock::now() < _endTime && isFinished() == false) { // TODO : Do it better ... like messaging/mutex_locked ... - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); } return *this; } diff --git a/zeus/Service.cpp b/zeus/Service.cpp index a85d78d..7c7c7d1 100644 --- a/zeus/Service.cpp +++ b/zeus/Service.cpp @@ -9,7 +9,7 @@ #include #include -#include + zeus::Service::Service() : propertyIp(this, "ip", "127.0.0.1", "Ip to connect server", &zeus::Service::onPropertyChangeIp), diff --git a/zeus/WebServer.cpp b/zeus/WebServer.cpp index 24422fb..7ff2913 100644 --- a/zeus/WebServer.cpp +++ b/zeus/WebServer.cpp @@ -6,7 +6,7 @@ #include #include #include -#include + #include @@ -84,7 +84,7 @@ void zeus::WebServer::connect(bool _async){ while ( _async == false && m_threadAsyncRunning == true && m_connection.isAlive() != true) { - usleep(50000); + std::this_thread::sleep_for(std::chrono::milliseconds(50)); } //ethread::setPriority(*m_receiveThread, -6); if (_async == true) { @@ -281,7 +281,7 @@ void zeus::WebServer::threadAsyncCallback() { m_threadAsyncList2.clear(); } if (m_threadAsyncList.size() == 0) { - usleep(10000); + std::this_thread::sleep_for(std::chrono::milliseconds(10)); continue; } auto it = m_threadAsyncList.begin();