Skip to content

Commit

Permalink
examples: cpp: Use std::this_thread::sleep_for instead of usleep
Browse files Browse the repository at this point in the history
Signed-off-by: Siddharth Chandrasekaran <sidcha.dev@gmail.com>
  • Loading branch information
sidcha committed Mar 23, 2024
1 parent 2495e3f commit 338a460
Show file tree
Hide file tree
Showing 2 changed files with 6 additions and 4 deletions.
5 changes: 3 additions & 2 deletions examples/cpp/cp_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/

#include <iostream>
#include <unistd.h>
#include <chrono>
#include <thread>
#include <osdp.hpp>

int sample_cp_send_func(void *data, uint8_t *buf, int len)
Expand Down Expand Up @@ -60,7 +61,7 @@ int main()
// your application code.

cp.refresh();
usleep(1000);
std::this_thread::sleep_for(std::chrono::microseconds(10 * 1000));
}

return 0;
Expand Down
5 changes: 3 additions & 2 deletions examples/cpp/pd_app.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,8 @@
*/

#include <iostream>
#include <unistd.h>
#include <chrono>
#include <thread>
#include <osdp.hpp>

int sample_pd_send_func(void *data, uint8_t *buf, int len)
Expand Down Expand Up @@ -86,7 +87,7 @@ int main()
pd.refresh();

// your application code.
usleep(1000);
std::this_thread::sleep_for(std::chrono::microseconds(10 * 1000));
}

return 0;
Expand Down

0 comments on commit 338a460

Please sign in to comment.