From c53a22fe9222fe00062383e2d46b0c0a6d862eb5 Mon Sep 17 00:00:00 2001 From: soroshsabz Date: Fri, 24 Feb 2023 01:35:57 +0330 Subject: [PATCH 1/5] Update gitignore. --- .gitignore | 7 +++++++ 1 file changed, 7 insertions(+) create mode 100644 .gitignore diff --git a/.gitignore b/.gitignore new file mode 100644 index 0000000..9ed605b --- /dev/null +++ b/.gitignore @@ -0,0 +1,7 @@ +################################################################################ +# This .gitignore file was automatically created by Microsoft(R) Visual Studio. +################################################################################ + +/.vs +/out/build/x64-debug +/temp From 4addd8386c23033c7864dd54e1a5d50785421f85 Mon Sep 17 00:00:00 2001 From: soroshsabz Date: Fri, 24 Feb 2023 01:36:22 +0330 Subject: [PATCH 2/5] Removed nanosleep. (fixes #80) --- src/main.cpp | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/main.cpp b/src/main.cpp index 2b63bce..c8367b1 100644 --- a/src/main.cpp +++ b/src/main.cpp @@ -20,6 +20,8 @@ #include #include +#include +#include #include #include "main.h" #include "commands.h" @@ -459,10 +461,8 @@ bool Manager::SendDTMF(const PString &dtmf) // sleep a while std::cout << "sent DTMF: [" << dtmf[i] << "]" << std::endl; - struct timespec tp; - tp.tv_sec = 0; - tp.tv_nsec = 500 * 1000 * 1000; // half a second - nanosleep (&tp, 0); + using namespace std::chrono_literals; + std::this_thread::sleep_for(500ms); } } ok = (i == dtmf.GetSize() - 1 ? true : false); From 8c91cde2eea04262bc765c043b88eeca958b1886 Mon Sep 17 00:00:00 2001 From: soroshsabz Date: Fri, 24 Feb 2023 10:51:54 +0330 Subject: [PATCH 3/5] Update .gitignore --- .gitignore | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.gitignore b/.gitignore index 9ed605b..ed8b864 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ ################################################################################ /.vs -/out/build/x64-debug +/out /temp From 721d47358fd294a06483e5c04fd7c9b8ac3508a7 Mon Sep 17 00:00:00 2001 From: soroshsabz Date: Fri, 24 Feb 2023 13:49:36 +0330 Subject: [PATCH 4/5] remove another sleep. (see #80) --- src/commands.cpp | 5 ++++- 1 file changed, 4 insertions(+), 1 deletion(-) diff --git a/src/commands.cpp b/src/commands.cpp index 0a40a57..f650b3e 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -21,9 +21,11 @@ #include #include #include +#include #include #include #include +#include #include "commands.h" #include "state.h" @@ -497,7 +499,8 @@ bool Wait::RunCommand(const std::string &loopsuffix) { return true; } //cout << "Wait: usleep " << n << endl; - usleep(WAIT_SLEEP_ACCURACY * 1000); + using namespace std::chrono_literals; + std::this_thread::sleep_for((WAIT_SLEEP_ACCURACY * 1000)us); if(!closed && TPState::Instance().GetState() == TPState::TERMINATED) { errorstring = "Wait: application terminated"; From 06cbf4634a47df08acff5010649713db4558b43a Mon Sep 17 00:00:00 2001 From: soroshsabz Date: Fri, 24 Feb 2023 14:26:23 +0330 Subject: [PATCH 5/5] resolve compile error. --- src/commands.cpp | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/commands.cpp b/src/commands.cpp index f650b3e..8bad6ac 100644 --- a/src/commands.cpp +++ b/src/commands.cpp @@ -499,8 +499,7 @@ bool Wait::RunCommand(const std::string &loopsuffix) { return true; } //cout << "Wait: usleep " << n << endl; - using namespace std::chrono_literals; - std::this_thread::sleep_for((WAIT_SLEEP_ACCURACY * 1000)us); + std::this_thread::sleep_for(std::chrono::duration(WAIT_SLEEP_ACCURACY)); if(!closed && TPState::Instance().GetState() == TPState::TERMINATED) { errorstring = "Wait: application terminated";