设为首页 加入收藏

TOP

基于EPOLL写的HTTP服务器(加入了线程池)(五)
2012-08-26 14:11:58 】 浏览:11818
Tags:基于 EPOLL HTTP 服务器 加入 线程
nbsp;   evs[i].data.fd=-1;

                                               }
               else if(len==EAGAIN)
                                            {
                 printf("socket huan cun man le!\n");

                                            }
               else
                                            {
                  //client读取出错
                  printf("Client read failed!\n");
                                            }
       thread_para[0] = 0;//设置线程占用标志为"空闲"
       goto wait_unlock;

       printf("pthread exit!\n");
       pthread_exit(NULL);

}

static int init_thread_pool(void)
{
    int i,rc;
    for(i=0;i<THREAD_MAX;i++)
    {
     s_thread_para[i][0]=0;  //idle
     s_thread_para[i][7]=i;   //thread pool ID
     pthread_mutex_lock(s_mutex+i);   //thread lock
    }
    // create thread pool
    for(i=0;i<THREAD_MAX;i++)
    {  rc=pthread_create(s_tid+i,0,(void *(*)(void*))&http_server,(void *)(s_thread_para[i]));
       if(0!=rc)
        { fprintf(stderr,"Create thread failed!\n");
  &n
首页 上一页 2 3 4 5 6 7 下一页 尾页 5/7/7
】【打印繁体】【投稿】【收藏】 【推荐】【举报】【评论】 【关闭】 【返回顶部
上一篇 select, poll和epoll的区别 下一篇VC实现线程池

最新文章

热门文章

Hot 文章

Python

C 语言

C++基础

大数据基础

linux编程基础

C/C++面试题目