摘要: #define pthread_cleanup_push(func, val) \ { \ struct __darwin_pthread_handler_rec __handler; \ pthread_t __self = pthread_self(); \ __handler.__routin 阅读全文
posted @ 2018-01-22 21:57 zzfx 阅读(182) 评论(0) 推荐(0)
摘要: 基本概念pthread_cancel调用并不等待线程终止,它只提出请求。线程在取消请求(pthread_cancel)发出后会继续运行,直到到达某个取消点(CancellationPoint)。取消点是线程检查是否被取消并按照请求进行动作的一个位置. 与线程取消相关的pthread函数int pth 阅读全文
posted @ 2018-01-22 21:24 zzfx 阅读(221) 评论(0) 推荐(0)
摘要: 资源分为两类: 1)系统维护的资源; 2)线程自身维护的资源:文件语柄、同步变量等; 线程自身维护的资源需要自身来释放。 资源使用、同步使用; 资源清理: 线程pthread_cleanup_push的简单例程. 阅读全文
posted @ 2018-01-22 21:23 zzfx 阅读(153) 评论(0) 推荐(0)
摘要: Concurrency is when two tasks can start, run, and complete in overlapping time periods. Parallelism is when tasks literally run at the same time, eg. 阅读全文
posted @ 2018-01-22 21:13 zzfx 阅读(143) 评论(0) 推荐(0)