Basic signal handling in C++

后端 未结 4 372
隐瞒了意图╮
隐瞒了意图╮ 2021-01-02 02:22

This is a pretty basic scenario but I\'m not finding too many helpful resources. I have a C++ program running in Linux that does file processing. Reads lines, does various t

4条回答
  •  春和景丽
    2021-01-02 03:12

    There are several possibilities; it would not necessarily be overkill to implement all of them:

    • Respond to a specific signal, just like C does. C++ works the same way. See the documentation for signal().
    • Trigger on the modification timestamp of some file changing, like the database if it is stored in a flat file.
    • Trigger once per hour, or once per day (whatever makes sense).

提交回复
热议问题