Skip to content

Commit

Permalink
updated README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
johnpatek committed Jan 5, 2025
1 parent aaf109d commit 683f4fc
Showing 1 changed file with 4 additions and 15 deletions.
19 changes: 4 additions & 15 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -85,27 +85,16 @@ Basic SigFn usage in C++. It is copied from `pause.cpp` in the
```c++
#include <sigfn.hpp>
#include <iostream>
#include <thread>
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;
}
```

0 comments on commit 683f4fc

Please sign in to comment.