]> git.feebdaed.xyz Git - linuxyz.git/commitdiff
remove confusion
authorseantywork <seantywork@gmail.com>
Fri, 8 Aug 2025 07:47:24 +0000 (16:47 +0900)
committerseantywork <seantywork@gmail.com>
Fri, 8 Aug 2025 07:47:24 +0000 (16:47 +0900)
fault-signal/2508-02.xyz.md
fault-signal/main.c

index 8094ea1de89fdcfbfc987cd511003c038b05b25e..3a233fa8217937176a0b67acb654f7bdd1411ba3 100644 (file)
@@ -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
+
 
 ```
 
index 0e8c3a948fa6007f36c6645fbca020883f17a92b..b62f752d700e56e4812d5e89565b17da1b6c55f0 100644 (file)
@@ -4,19 +4,15 @@
 #include <time.h>
 #include <signal.h>
 #include <unistd.h>
-#include <pthread.h>
-
-
-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);