上一页 1 2 3 4 5 6 ··· 24 下一页

2023年4月20日

新风格的信号通信

摘要: #include "stdio.h" #include "signal.h" void sig_handler(int sig) { printf("接受到了%d号信号\n", sig); } void sig_action(int sig, siginfo_t *siginfo, void * r 阅读全文

posted @ 2023-04-20 20:36 信奉上帝的小和尚 阅读(11) 评论(0) 推荐(0)

2023年4月13日

信号屏蔽

摘要: #include "stdio.h" #include "signal.h" #include "unistd.h" void db_update(void) { // 模拟数据库更新操作 for (int i = 0; i <= 5; i +=1) { printf("更新数据库.\n"); sl 阅读全文

posted @ 2023-04-13 21:08 信奉上帝的小和尚 阅读(21) 评论(0) 推荐(0)

2023年4月7日

通过信号的方式回收子进程

摘要: #include "stdio.h" #include "sys/wait.h" #include "signal.h" #include "unistd.h" #include "errno.h" void wait_child(int sig) { printf("接受到了信号:%d\n", s 阅读全文

posted @ 2023-04-07 10:33 信奉上帝的小和尚 阅读(65) 评论(0) 推荐(0)

2023年4月6日

子进程

摘要: #include <stdio.h> #include <unistd.h> int main(void){ //创建一个子进程,创建完成后,通过返加值pid来判断是父进程还是子进程,父进程中pid!=0 子进程中pid==0 int pid = fork(); if (pid == 0){ // 阅读全文

posted @ 2023-04-06 17:27 信奉上帝的小和尚 阅读(17) 评论(0) 推荐(0)

信号

摘要: #include <stdio.h> #include <signal.h> void signal_handler(int signum) { printf("我接受到了%d信号\n", signum); } int main(void) { // 捕获信号 // SIGINT 是2号信号 ctr 阅读全文

posted @ 2023-04-06 17:26 信奉上帝的小和尚 阅读(6) 评论(0) 推荐(0)

2023年3月6日

golang下载源配置

摘要: https://goproxy.cn/ 阅读全文

posted @ 2023-03-06 11:04 信奉上帝的小和尚 阅读(82) 评论(0) 推荐(0)

2023年2月27日

文件锁

摘要: #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <string.h> int wlock(int fd, int wait) { struct flock lock; // 操作类型 F_RDLCK 读锁, F_W 阅读全文

posted @ 2023-02-27 11:40 信奉上帝的小和尚 阅读(10) 评论(0) 推荐(0)

2023年2月25日

golang yaml配置

摘要: Redis配置文件结构体 package config type Redis struct { Host string `yaml:"host"` Password string `yaml:"password"` Port int `yaml:"port"` DB int `yaml:"db"` 阅读全文

posted @ 2023-02-25 16:22 信奉上帝的小和尚 阅读(348) 评论(0) 推荐(0)

golang 日志

摘要: package log import ( "NOONASN/global" "github.com/natefinch/lumberjack" "go.uber.org/zap" "go.uber.org/zap/zapcore" "os" "path" "path/filepath" ) func 阅读全文

posted @ 2023-02-25 14:28 信奉上帝的小和尚 阅读(41) 评论(0) 推荐(0)

2023年2月15日

文件操作

摘要: #include <stdio.h> #include <fcntl.h> #include <unistd.h> #include <string.h> int main(void) { /* * 打开文件 * int open (const char *__file, int __oflag, 阅读全文

posted @ 2023-02-15 20:16 信奉上帝的小和尚 阅读(6) 评论(0) 推荐(0)

上一页 1 2 3 4 5 6 ··· 24 下一页

导航