From 683f4fcd9ac6c9092705ea7bc93a1e73424835d8 Mon Sep 17 00:00:00 2001 From: John R Patek Sr Date: Sun, 5 Jan 2025 11:30:39 -0600 Subject: [PATCH] updated README.md --- README.md | 19 ++++--------------- 1 file changed, 4 insertions(+), 15 deletions(-) diff --git a/README.md b/README.md index 5ccf116..d97a2dd 100644 --- a/README.md +++ b/README.md @@ -85,27 +85,16 @@ Basic SigFn usage in C++. It is copied from `pause.cpp` in the ```c++ #include #include -#include int main(int argc, const char **argv) { - bool loop; - // set callback for SIGINT - sigfn::handle(SIGINT, [&](int signum) { - std::cout << std::endl << "Received signal: " << signum << std::endl; - loop = false; - }); - // notify user that the program is "paused" std::cout << "Paused. Press Ctrl+C to exit." << std::endl; - // sleep loop until we receive the signal - loop = true; - while(loop) - { - // sleep for 100ms - std::this_thread::sleep_for(std::chrono::milliseconds(100)); - } + sigfn::wait({SIGINT}); + + std::cout << std::endl << "Received signal: SIGINT" << std::endl; + return 0; } ```