您的位置:首页 > 运维架构 > Linux

测试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;
}
内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: