上一页 1 ··· 6 7 8 9 10 11 12 下一页
摘要: 父子进程匿名管道通讯 示例:pipe.c(子读父写) #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <sys/wait.h> #define BUFFSIZE 1024 int 阅读全文
posted @ 2022-08-03 08:07 *^VV^* 阅读(29) 评论(0) 推荐(0)
摘要: 通过多线程实现管道通讯 头文件:mypipe.h #ifndef __PIPE_H__#define __PIPE_H__ #define PIPE_RD 0x00000001UL //只读属性#define PIPE_WR 0x00000002UL //只写属性#define MAXLENTH 1 阅读全文
posted @ 2022-08-02 14:41 *^VV^* 阅读(138) 评论(0) 推荐(0)
摘要: 文件锁 int lockf(int fd, int cmd, off_t len); int flock(int fd, int operation); int fcntl(int fd, int cmd, ... /* arg */ ); 例程:lockf.c #include <stdio.h> 阅读全文
posted @ 2022-08-01 09:01 *^VV^* 阅读(101) 评论(0) 推荐(0)
摘要: 使用mmap创建进程间共享内存 例程:shm.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <sys/types.h>#include <sys/stat.h>#include <fcntl.h>#include 阅读全文
posted @ 2022-08-01 08:51 *^VV^* 阅读(113) 评论(0) 推荐(0)
摘要: 数据中继epoll模型 示例:relay_epoll.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include < 阅读全文
posted @ 2022-08-01 08:41 *^VV^* 阅读(44) 评论(0) 推荐(0)
摘要: 数据中继poll模型 示例:relay_poll.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include <po 阅读全文
posted @ 2022-08-01 08:21 *^VV^* 阅读(54) 评论(0) 推荐(0)
摘要: 数据中继select模型 示例:relay_select.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h>#include 阅读全文
posted @ 2022-07-29 21:32 *^VV^* 阅读(40) 评论(0) 推荐(0)
摘要: 通过有限状态机实现文件相互拷贝 示例:relay.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <unistd.h>#include <fcntl.h>#include <errno.h> #define FIL 阅读全文
posted @ 2022-07-28 09:50 *^VV^* 阅读(45) 评论(0) 推荐(0)
摘要: 多线程交替输出abcd,通过互斥量及信号控制。 示例:abcd_cond.c #include <stdio.h>#include <stdlib.h>#include <string.h>#include <pthread.h>#include <unistd.h>#include <signal 阅读全文
posted @ 2022-07-26 09:14 *^VV^* 阅读(61) 评论(0) 推荐(0)
摘要: 多线程通过竞争获取数据计算是否为质数。 例程:pthread_pool_busy.c #include <stdio.h>#include <stdlib.h>#include <pthread.h>#include <string.h> #define LEFT 30000000#define R 阅读全文
posted @ 2022-07-25 08:21 *^VV^* 阅读(62) 评论(0) 推荐(0)
上一页 1 ··· 6 7 8 9 10 11 12 下一页