测试LINUX下进程间阻塞的代码
2007-10-06 22:43
204 查看
#include <stdio.h>
#include <sys/types.h>
#include <signal.h>
#define BLOCK_PROCESS_PID 96
int main()
{
if(kill(BLOCK_PROCESS_PID,SIGSTOP) < 0) {
fprintf(stderr,"error occurs when trying to block the specified process. ");
exit(0);
}
printf("sleep for 10 seconds to view the result. ");
sleep(10);
printf("wake up to view the result. ");
if(kill(BLOCK_PROCESS_PID,SIGCONT) < 0) {
fprintf(stderr,"error occurs when trying to awake the process. ");
exit(0);
}
return 1;
}
#include <sys/types.h>
#include <signal.h>
#define BLOCK_PROCESS_PID 96
int main()
{
if(kill(BLOCK_PROCESS_PID,SIGSTOP) < 0) {
fprintf(stderr,"error occurs when trying to block the specified process. ");
exit(0);
}
printf("sleep for 10 seconds to view the result. ");
sleep(10);
printf("wake up to view the result. ");
if(kill(BLOCK_PROCESS_PID,SIGCONT) < 0) {
fprintf(stderr,"error occurs when trying to awake the process. ");
exit(0);
}
return 1;
}
相关文章推荐
- Linux平台代码覆盖率测试工具GCOV的前端工具LCOV简介
- Linux下c语言实验Websocket通讯 含客户端和服务器测试代码
- Linux 平台一种进程代码注入方法
- python 进程通信测试代码(程序A,程序B)
- 2017-02问题记录总结:linux下网络收发包性能测试代码、.bin和.elf文件格式区别
- Linux平台代码覆盖率测试工具GCOV的前端工具LCOV简介
- linux c 代码测试之内存越界及内存泄露
- linux下daemon守护进程的实现(以nginx代码为例)
- linux下创建守护进程(daemon process)代码-详细注释
- Linux下c语言实验Websocket通讯 含客户端和服务器测试代码
- linux下APUE的代码测试文件路径配置
- linux进程通信--管道(pipe)(含实例代码)
- linux进程系列(9)wait函数 代码示例
- linux下libphenom的测试代码
- 撸代码--linux进程通信(基于共享内存)
- linux 2.6源代码情景分析笔记之进程4
- linux-inject:注入代码到运行的Linux进程中
- Linux移植随笔:对tslib库的ts_test测试程序代码的一点分析
- protobuf在linux环境下c代码生成及测试
- Linux平台代码覆盖率测试工具gcov简介