I\'m writing a console application Windows that creates some objects in the main thread and kicks those off into a loop, only exiting when the user uses the Ctrl-C interrupt. <
You make your loop on a condition variable.
When you receive ctrl-C (SIGINT) you set the condition variable to false and return. The loop will then exit normally.
bool finished = false;
int main()
{
DBClient db;
DataPuller p;
while (!finished)
{
// ... do stuff until Ctrl-C comes in
}
}
// Signal handler or Control handler on windows
// Set finished = true.