This is compiled as sleep(0) and therefore there's no real sleep.
clang 6 warns:
src/optohybrid.cpp:465:15: warning: implicit conversion from 'double' to 'unsigned int' changes value from 0.1 to 0 [-Wliteral-conversion]
sleep(0.1);
~~~~~ ^~~
1 warning generated.
Types of issue
[x] Bug report (report an issue with the code)
[ ] Feature request (request for change which adds functionality)
Expected Behavior
If a call to sleep(0) is intended, use that instead. If a waiting time of 0.1s is intended, use std::this_thread::sleep_for(std::chrono::milliseconds(100)) (the C++ version is safer because it's not sensitive to signals).
Brief summary of issue
One can find the following call to
sleep(unsigned)
atsrc/optohybrid.cpp:465
:This is compiled as
sleep(0)
and therefore there's no real sleep.clang
6 warns:Types of issue
Expected Behavior
If a call to
sleep(0)
is intended, use that instead. If a waiting time of 0.1s is intended, usestd::this_thread::sleep_for(std::chrono::milliseconds(100))
(the C++ version is safer because it's not sensitive to signals).Current Behavior
Code is unclear.
Your Environment
clang
6.0.0libc
2.27