#define pthread_cleanup_push(func, val) \

{ \

struct __darwin_pthread_handler_rec __handler; \

pthread_t __self = pthread_self(); \

__handler.__routine = func; \

__handler.__arg = val; \

__handler.__next = __self->__cleanup_stack; \

__self->__cleanup_stack = &__handler;

#define pthread_cleanup_pop(execute) \

/* Note: 'handler' must be in this same lexical context! */ \

__self->__cleanup_stack = __handler.__next; \

if (execute) (__handler.__routine)(__handler.__arg); \

}

pthread_cleanup_push的更多相关文章

  1. Linux 下子线程的 pthread_cleanup_push() 和 pthread_cleanup_pop() 研究

    线程退出前可能有一些清理工作,但是这部分代码又不会放到线程主体部分,就需要挂接一个或者几个线程“清洁工”来做这部分事情.需要这对兄弟: #include<pthread.h> void p ...

  2. pthread_cleanup_push()/pthread_cleanup_pop()的详解

    一般来说,Posix的线程终止有两种情况:正常终止和非正常终止.线程主动调用pthread_exit()或者从线程函数中return都将使线程正常退出,这是可预见的退出方式:非正常终止是线程在其他线程 ...

  3. pthread_cleanup_push与pthread_cleanup_pop与pthread_cancel与pthread_testcancel

    参考: http://blog.csdn.net/zjc156m/article/details/9021343 http://blog.csdn.net/u010027547/article/det ...

  4. ZT pthread_cleanup_push()/pthread_cleanup_pop()的详解

    pthread_cleanup_push()/pthread_cleanup_pop()的详解 分类: Linux 2010-09-28 16:02 1271人阅读 评论(1) 收藏 举报 async ...

  5. ZT 线程处理函数pthread_cleanup_push / pthread_cleanup_pop

    http://bbs.csdn.net/topics/390688105 2)创建了线程,但是线程退出时没有线程调用pthread_join() 线程资源没有回收,如果持续创建线程,到一定数量后将不能 ...

  6. 线程pthread_cleanup_push的简单例程.

    http://www.cnblogs.com/hnrainll/archive/2011/04/20/2022149.html #include<stdlib.h> #include< ...

  7. pthread_cleanup_push和pthread_cleanup_pop清除函数是否执行的说明

    示例1: #include <stdio.h> #include <pthread.h> void* clean(void* arg) { printf("clean ...

  8. pthread_cleanup_push与pthread_cleanup_pop的理解

    一.为什么会有pthread_cleanup_push与pthread_cleanup_pop: 一般来说,Posix的线程终止有两种情况:正常终止和非正常终止.线程主动调用pthread_exit( ...

  9. pthread_cleanup_push vs Autorelease VS 异常处理

    黑幕背后的Autorelease http://www.cnblogs.com/feng9exe/p/7239552.html objc_autoreleasePoolPush的返回值正是这个哨兵对象 ...

随机推荐

  1. 立即执行函数与Function

    js立即执行函数: (function ( ){})( ) 与 (function ( ){}( )) 与new Function()区别? new Function() 还是有区别的,fn = ne ...

  2. TCP基本概念

    TCP协议是一个复杂的.可靠的字节流协议.不通用UDP协议. TCP提供客户与服务器之间的连接.TCP客户先与给定的服务器建立一个连接,再跨该连接与服务器交换数据,最后终止这个连接. TCP提供了可靠 ...

  3. Unity的SendMessage方法

    用法(该对象所有脚本都能收到): gameObject.SendMessage("要执行的方法名"); 通知的另一种实现: gameObject.GetComponent<脚 ...

  4. Pyhton学习——Day10

    #################################################################################################### ...

  5. easyUI datagarid单元格动态合并

    第二列根据第一列合并,第三列根据第二列合并.层级关系. /* * tableID表格的id * colList要合并的字段例如:"overcount,totalcount" */ ...

  6. PAT 天梯赛练习集 L2-022. 重排链表

    题目链接:https://www.patest.cn/contests/gplt/L2-022 给定一个单链表 L1→L2→...→Ln-1→Ln,请编写程序将链表重新排列为 Ln→L1→Ln-1→L ...

  7. WePy--记录使用过程中的一些坑

    讲真, 官方文档还是要好好看, 都是细节啊... 1- 使用wepy框架中封装好的小程序api  <wepy 对小程序的API进行Promise处理>   ①: 首先需要声明 开启使用we ...

  8. VUE:内置指令与自定义指令

    VUE:内置指令与自定义指令 常用的内置指令 1)v:text 更新元素的 textContent 2)v-html 更新元素的 innerHTML 3)v-if 如果为true,当前标签才会输出到页 ...

  9. Git学习总结(10)——git 常用命令汇总

    1.git 基本概念: 工作区:改动(增删文件和内容) 暂存区:输入命令:git add 改动的文件名,此次改动就放到了'暂存区'(新增的文件) 本地仓库(简称:本地):输入命令:git commit ...

  10. angular-事件

    ng-click事件 1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 <div ng-app="myApp ...