免费注册 查看新帖 |

Chinaunix

  平台 论坛 博客 文库
最近访问板块 发新帖
查看: 2490 | 回复: 1
打印 上一主题 下一主题

[函数] 关于pthread_cleanup_push注册的清理函数被执行的疑问 [复制链接]

论坛徽章:
4
水瓶座
日期:2013-09-06 12:27:30摩羯座
日期:2013-09-28 14:07:46处女座
日期:2013-10-24 14:25:01酉鸡
日期:2014-04-07 11:54:15
1 [报告]
发表于 2013-02-05 15:36 |显示全部楼层
       A cancellation clean-up handler is popped from the stack and executed in the following circumstances:

       1. When a thread is canceled, all of the stacked clean-up handlers are popped and executed in the reverse of  the
          order in which they were pushed onto the stack.

       2. When  a  thread  terminates by calling pthread_exit(3), all clean-up handlers are executed as described in the
          preceding point.  (Clean-up handlers are not called if the thread terminates by performing a return  from  the
          thread start function.)

       3. When  a  thread  calls pthread_cleanup_pop() with a nonzero execute argument, the top-most clean-up handler is
          popped and executed.     


  POSIX.1 says that the effect of using return, break, continue, or goto to prematurely  leave  a  block  bracketed
       pthread_cleanup_push() and pthread_cleanup_pop() is undefined.  Portable applications should avoid doing this.

论坛徽章:
4
水瓶座
日期:2013-09-06 12:27:30摩羯座
日期:2013-09-28 14:07:46处女座
日期:2013-10-24 14:25:01酉鸡
日期:2014-04-07 11:54:15
2 [报告]
发表于 2013-02-05 15:47 |显示全部楼层
POSIX.1 says that the effect of using return, break, continue, or goto to prematurely  leave  a  block  bracketed
       pthread_cleanup_push() and pthread_cleanup_pop() is undefined.  Portable applications should avoid doing this.
您需要登录后才可以回帖 登录 | 注册

本版积分规则 发表回复

  

北京盛拓优讯信息技术有限公司. 版权所有 京ICP备16024965号-6 北京市公安局海淀分局网监中心备案编号:11010802020122 niuxiaotong@pcpop.com 17352615567
未成年举报专区
中国互联网协会会员  联系我们:huangweiwei@itpub.net
感谢所有关心和支持过ChinaUnix的朋友们 转载本站内容请注明原作者名及出处

清除 Cookies - ChinaUnix - Archiver - WAP - TOP