From: seantywork Date: Fri, 8 Aug 2025 07:47:24 +0000 (+0900) Subject: remove confusion X-Git-Url: https://git.feebdaed.xyz/?a=commitdiff_plain;h=ef07a2d330a24a0fabda1a237e6ca19ad411bc17;p=linuxyz.git remove confusion --- diff --git a/fault-signal/2508-02.xyz.md b/fault-signal/2508-02.xyz.md index 8094ea1..3a233fa 100644 --- a/fault-signal/2508-02.xyz.md +++ b/fault-signal/2508-02.xyz.md @@ -2,23 +2,18 @@ ```shell ... -[2025-08-08 16:13:45] counting: 2464200 -[2025-08-08 16:13:45] counting: 2464300 -[2025-08-08 16:13:45] counting: 2464400 -[2025-08-08 16:13:45] counting: 2464500 -[2025-08-08 16:13:45] counting: 2464600 -[2025-08-08 16:13:45] counting: 2464700 -[2025-08-08 16:13:45] counting: 2464800 -[2025-08-08 16:13:45] counting: 2464900 -[2025-08-08 16:13:45] counting: 2465000 -[2025-08-08 16:13:45] counting: 2465100 -[2025-08-08 16:13:45] counting: 2465200 -[2025-08-08 16:13:45] counting: 2465300 -[2025-08-08 16:13:45] counting: 2465400 -[2025-08-08 16:13:45] counting: 2465500 -[2025-08-08 16:13:45] counting: 2465600 -[2025-08-08 16:13:45] counting: 2465700 -^Csig received 2: 2465790 +[2025-08-08 16:46:37] counting: 3360400 +[2025-08-08 16:46:37] counting: 3360500 +[2025-08-08 16:46:37] counting: 3360600 +[2025-08-08 16:46:37] counting: 3360700 +[2025-08-08 16:46:37] counting: 3360800 +[2025-08-08 16:46:37] counting: 3360900 +[2025-08-08 16:46:37] counting: 3361000 +[2025-08-08 16:46:37] counting: 3361100 +[2025-08-08 16:46:37] counting: 3361200 +[2025-08-08 16:46:37] counting: 3361300 +^Csig received 2 + ``` diff --git a/fault-signal/main.c b/fault-signal/main.c index 0e8c3a9..b62f752 100644 --- a/fault-signal/main.c +++ b/fault-signal/main.c @@ -4,19 +4,15 @@ #include #include #include -#include - - -int counter = 0; void ch_handler(int sig){ struct tm tm_info; char timebuf[128] = {0}; time_t ch_timer = time(NULL); - printf("sig received %d: %d\n", sig, counter); + printf("sig received %d\n", sig); localtime_r(&ch_timer, &tm_info); strftime(timebuf, 128, "%Y-%m-%d %H:%M:%S", &tm_info); - printf("[%s] signal handled: %d\n", timebuf, counter); + printf("[%s] signal handled: %d\n", timebuf); } @@ -25,6 +21,7 @@ int main(int argc, char** argv){ time_t timer; struct tm tm_info; pthread_t tid; + int counter = 0; char timebuf[128] = {0}; signal(SIGINT, ch_handler);