linux下线程调用sleep,进程挂起
http://blog.csdn.net/horstlinux/article/details/7911457
http://blog.csdn.net/eroswang/article/details/2932630
分类: Linux开发c/c++2008-09-15 13:05 1788人阅读 评论(0) 收藏 举报
在linux下调用sleep是用时钟的,一个进程的时钟系统是有限制的.如果每个线程使用sleep,到了最大的数量,最终会进程会挂起.最好是用select取代
void select_sleep(int i)
{
struct timeval timeout;
timeout.tv_sec = i;
timeout.tv_usec = 0;
select( 0, NULL, NULL, NULL, & timeout );
}
posted on 2015-05-10 10:32 okgogo2000 阅读(298) 评论(0) 编辑 收藏 举报