Skip to content

Commit

Permalink
Replace usleep(..) by std::this_thread::sleep_for(std::chrono::micros…
Browse files Browse the repository at this point in the history
…econds(..)) see PR ngscopeclient#262
  • Loading branch information
bvernoux committed Sep 23, 2020
1 parent 60a07cf commit 776cedd
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 1 addition & 1 deletion scopehal/Oscilloscope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -149,7 +149,7 @@ bool Oscilloscope::WaitForTrigger(int timeout)
{
if(HasPendingWaveforms())
return true;
usleep(10 * 1000);
std::this_thread::sleep_for(std::chrono::microseconds(10 * 1000));
}

return false;
Expand Down
2 changes: 1 addition & 1 deletion scopehal/SignalGeneratorOscilloscope.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -117,7 +117,7 @@ Oscilloscope::TriggerMode SignalGeneratorOscilloscope::PollTrigger()
bool SignalGeneratorOscilloscope::AcquireData()
{
//cap waveform rate at 25 wfm/s to avoid saturating cpu etc with channel emulation
usleep(40 * 1000);
std::this_thread::sleep_for(std::chrono::microseconds(40 * 1000));

auto waveform = m_bufmodel->SimulatePRBS(
rand(),
Expand Down
2 changes: 2 additions & 0 deletions scopehal/scopehal.h
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,8 @@
#include <string>
#include <map>
#include <stdint.h>
#include <chrono>
#include <thread>

#include <sigc++/sigc++.h>
#include <cairomm/context.h>
Expand Down

0 comments on commit 776cedd

Please sign in to comment.