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

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 信奉上帝的小和尚 阅读(19) 评论(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 信奉上帝的小和尚 阅读(47) 评论(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 信奉上帝的小和尚 阅读(13) 评论(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 信奉上帝的小和尚 阅读(5) 评论(0) 推荐(0) 编辑

2023年3月6日

golang下载源配置

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

posted @ 2023-03-06 11:04 信奉上帝的小和尚 阅读(75) 评论(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 信奉上帝的小和尚 阅读(8) 评论(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 信奉上帝的小和尚 阅读(326) 评论(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 信奉上帝的小和尚 阅读(36) 评论(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 信奉上帝的小和尚 阅读(3) 评论(0) 推荐(0) 编辑

2023年2月8日

虚拟内存跟物理内存之间的映射mmap\munmap

摘要: #include <stdio.h> #include <sys/mman.h> int main(void) { /* * 创建虚拟内存的映射 * void *mmap (void *__addr, size_t __len, int __prot,int __flags, int __fd, _ 阅读全文

posted @ 2023-02-08 21:29 信奉上帝的小和尚 阅读(88) 评论(0) 推荐(0) 编辑

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

导航