Skip to content

Commit 77fafeb

Browse files
committed
renaming sleep macro to sleep_msec
1 parent 881ada7 commit 77fafeb

File tree

5 files changed

+10
-10
lines changed

5 files changed

+10
-10
lines changed

src/dds.net-connector-cpp.lib/connector/src/ddsconnector.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -148,7 +148,7 @@ void
148148

149149
unregisterVariablesFromServer();
150150

151-
sleep(100);
151+
sleep_msec(100);
152152

153153
dataReceiverThread->stop();
154154

src/dds.net-connector-cpp.lib/connector/src/internal/inc/macros.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
#include <thread>
77

88

9-
#define sleep(msec) std::this_thread::sleep_for(std::chrono::milliseconds(msec))
9+
#define sleep_msec(msec) { std::chrono::milliseconds ms(msec); std::this_thread::sleep_for(ms); }
1010

1111
#define CONSOLE_COLOR_FG_BLACK "\033[0;30m"
1212
#define CONSOLE_COLOR_FG_RED "\033[0;31m"

src/dds.net-connector-cpp.lib/connector/src/internal/src/easy_thread.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ void dds::net::connector::_internal::continuousThreadFunction(EasyThread* th)
8484

8585
if (doneSomething == false && th->isThreadRunning == true)
8686
{
87-
sleep(SLEEP_TIME_WHEN_NOT_DONE_ANYTHING_MSEC);
87+
sleep_msec(SLEEP_TIME_WHEN_NOT_DONE_ANYTHING_MSEC);
8888
}
8989
}
9090
}
@@ -97,7 +97,7 @@ void dds::net::connector::_internal::periodicThreadFunction(EasyThread* th)
9797

9898
if (th->isThreadRunning == true)
9999
{
100-
sleep(th->periodicity);
100+
sleep_msec(th->periodicity);
101101
}
102102
}
103103
}

src/dds.net-connector-cpp.lib/connector/src/internal/src/network_client.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -239,7 +239,7 @@ void
239239

240240
if (!doneAnythingInIteration)
241241
{
242-
sleep(10);
242+
sleep_msec(10);
243243
}
244244
}
245245
} // while (isIOThreadStarted)
@@ -330,9 +330,9 @@ void
330330
std::string error = "Failed to resolve the hostname: ";
331331
error += this->ipv4;
332332

333-
logger->logError(error.c_str());
333+
logger->error(error.c_str());
334334
dataLock.unlock();
335-
return false;
335+
return;
336336
}
337337

338338
addr_list = (struct in_addr**)he->h_addr_list;
@@ -452,7 +452,7 @@ void
452452

453453
logger->error(errorMessage.c_str());
454454

455-
sleep(1000);
455+
sleep_msec(1000);
456456
}
457457
else
458458
{

src/dds.net-connector-cpp.lib/connector/src/internal/src/sync_queue.cpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -71,7 +71,7 @@ T dds::net::connector::_internal::SyncQueue<T>::dequeue()
7171

7272
lock.unlock();
7373

74-
sleep(SLEEP_TIME_MS_WHEN_DATA_CANNOT_BE_DEQUEUED);
74+
sleep_msec(SLEEP_TIME_MS_WHEN_DATA_CANNOT_BE_DEQUEUED);
7575
}
7676
}
7777

@@ -114,7 +114,7 @@ void dds::net::connector::_internal::SyncQueue<T>::enqueue(T data)
114114

115115
lock.unlock();
116116

117-
sleep(SLEEP_TIME_MS_WHEN_DATA_CANNOT_BE_ENQUEUED);
117+
sleep_msec(SLEEP_TIME_MS_WHEN_DATA_CANNOT_BE_ENQUEUED);
118118
}
119119
}
120120

0 commit comments

Comments
 (0)