首页 诗词 字典 板报 句子 名言 友答 励志 学校 网站地图
当前位置: 首页 > 教程频道 > 操作系统 > UNIXLINUX >

【多线程程序】 must be installed for pthread_cancel to work,该如何解决

2014-01-23 
【多线程程序】 must be installed for pthread_cancel to work各位好实在百度不到结果,希望有朋友指点一下

【多线程程序】 must be installed for pthread_cancel to work
各位好
       实在百度不到结果,希望有朋友指点一下

  程序主要功能 服务器根据客户端的请求,创建对应的线程处理并使用读写锁。
  1.服务器不能阻塞,所以起的线程都是分离状态的,期望自己exit的时候自动回收资源
  2.当stop的时候,可以阻塞,所以起的线程不是分离状态的,使用pthread_join来等待stop线程结束

 测试的时候发现,当有写操作时候,立刻运行stop,程序会等到写操作结束后,运行stop线程(因为都申请了写锁),可是有概率系统会出现如下错误,然后程序退出
,打印信息可看出程序跑的pthread_join()就没跑下去了。
symbol '__aeabi_unwind_cpp_pr0': can't resolve symbol
libgcc_s.so.1 must be installed for pthread_cancel to work  



while(1)
{
 com_fd=accept(listen_fd,(struct sockaddr*)&clt_addr,&len); 
   ....
   if(msgcmd.cmd==stop)
   {
   mcos("\nstop[%lu]!\n",msgcmd.secs);
fd_stop=com_fd;
memset(&threadrd, 0, sizeof(threadrd));          //comment1
        if((temp = pthread_create(&threadrd, NULL, do_stop, NULL)) != 0)
          mcos("pthread create error!\n");

pthread_join(threadrd, NULL);//block
m_stop();//销毁之前申请的锁
write(fd_stop,"stop",4);
close(fd_stop);
unlink(UNIX_DOMAIN);
    return 0;
   }
msgcmd.fd=com_fd;
//mcos("[%lu]:once fd=[%d]\n",pthread_self(),msgcmd.fd);
  m_do_action(&msgcmd);
pthread_cond_wait(&m_Cond,&m_Locker);       // 这里将会被阻塞,直到另外的线程函数做完了需要做的事情才会解除这里的阻塞
   pthread_mutex_unlock(&m_Locker);
  }
}
[解决办法]
不懂帮顶。。

热点排行