上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 102 下一页
摘要: 线程退出油多种方式,如return,pthread_exit,pthread_cancel等;线程分为可结合的(joinable)和 分离的(detached)两种,如果没有在创建线程时设置线程的属性为PTHREAD_CREATE_DETACHED,则线程默认是可结合的。可结合的线程在线程退出后不会 阅读全文
posted @ 2018-01-24 10:47 zzfx 阅读(1174) 评论(0) 推荐(0)
摘要: 阻塞状态(Blocked) 线程运行过程中,可能由于各种原因进入阻塞状态: 1>线程通过调用sleep方法进入睡眠状态; 2>线程调用一个在I/O上被阻塞的操作,即该操作在输入输出操作完成之前不会返回到它的调用者; 3>线程试图得到一个锁,而该锁正被其他线程持有; 4>线程在等待某个触发条件; .. 阅读全文
posted @ 2018-01-23 18:30 zzfx 阅读(1314) 评论(0) 推荐(0)
摘要: 黑幕背后的Autorelease http://www.cnblogs.com/feng9exe/p/7239552.html objc_autoreleasePoolPush的返回值正是这个哨兵对象的地址,被objc_autoreleasePoolPop(哨兵对象)作为入参,于是: 假设这些都有线 阅读全文
posted @ 2018-01-23 17:47 zzfx 阅读(152) 评论(0) 推荐(0)
摘要: Thread Control Block The following is the declaration of the Thread Control Block. unsigned int status This field holds the status information of the 阅读全文
posted @ 2018-01-23 17:02 zzfx 阅读(236) 评论(0) 推荐(0)
摘要: #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 阅读(184) 评论(0) 推荐(0)
摘要: 基本概念pthread_cancel调用并不等待线程终止,它只提出请求。线程在取消请求(pthread_cancel)发出后会继续运行,直到到达某个取消点(CancellationPoint)。取消点是线程检查是否被取消并按照请求进行动作的一个位置. 与线程取消相关的pthread函数int pth 阅读全文
posted @ 2018-01-22 21:24 zzfx 阅读(222) 评论(0) 推荐(0)
摘要: 资源分为两类: 1)系统维护的资源; 2)线程自身维护的资源:文件语柄、同步变量等; 线程自身维护的资源需要自身来释放。 资源使用、同步使用; 资源清理: 线程pthread_cleanup_push的简单例程. 阅读全文
posted @ 2018-01-22 21:23 zzfx 阅读(156) 评论(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 阅读(145) 评论(0) 推荐(0)
摘要: 与动态语言有关的概念:1、反射 2、运行时 3、编译器、静态。 所谓的动态语言指的是语言单元的结构、行为、类型可以在运行时发生改变的语言。 可以动态添加新的类型; Dynamic programming language, in computer science, is a class of hig 阅读全文
posted @ 2018-01-21 10:07 zzfx 阅读(395) 评论(0) 推荐(0)
摘要: In object-oriented programming, a metaclass is a class whose instances are classes. Just as an ordinary class defines the behavior of certain objects, 阅读全文
posted @ 2018-01-20 23:14 zzfx 阅读(140) 评论(0) 推荐(0)
摘要: In some languages, classes are only a compile-time feature (new classes cannot be declared at runtime), while in other languages classes are first-cla 阅读全文
posted @ 2018-01-20 22:45 zzfx 阅读(158) 评论(0) 推荐(0)
摘要: eval is a function which evaluates a string as though it were an expression and returns a result; in others, it executes multiple lines of code as tho 阅读全文
posted @ 2018-01-20 22:11 zzfx 阅读(189) 评论(0) 推荐(0)
摘要: 线程的关系就如同一个家庭里父子关系、独生子、多兄弟的关系; 有控制、独立完成、协作完成、资源竞争等情况发生。 同时线程具有生命周期,由生老病死等情况发生。 或者如同一个工厂的构成: 工厂拥有所有资源; 员工和管理者各司其职; 竞争使用资源或协作完成任务。 1、单任务线程,除了启动和完成没有和其它线程 阅读全文
posted @ 2018-01-19 22:02 zzfx 阅读(221) 评论(0) 推荐(0)
摘要: 线程的核心是算法,是面向过程的。 算法的协作的控制就相当于线程间的关系。 阅读全文
posted @ 2018-01-19 21:58 zzfx 阅读(242) 评论(0) 推荐(0)
摘要: 线程的阻塞状态与线程控制结构密切相关; 线程的阻塞点是同步变量的部署点; 线程的取消点是线程的死亡点。 阅读全文
posted @ 2018-01-19 21:57 zzfx 阅读(143) 评论(0) 推荐(0)
摘要: 结构化编程的要点就是控制流。 结构化编程的控制流是通过变量的比较进行的; 线程的执行也有控制流; 线程流程的控制是通过同步变量完成的; 线程的同步变量是由内核提供的; 阅读全文
posted @ 2018-01-19 21:50 zzfx 阅读(135) 评论(0) 推荐(0)
摘要: 所谓的线程安全指的是线程执行时上线文数据的一致性能够得到保证。 线程的运行环境保持一致。 线程安全要考虑的问题是“刻舟求剑”的问题。 阅读全文
posted @ 2018-01-19 21:23 zzfx 阅读(127) 评论(0) 推荐(0)
摘要: 将数据结构和操作数据结构的算法进行了绑定。 阅读全文
posted @ 2018-01-19 20:39 zzfx 阅读(129) 评论(0) 推荐(0)
摘要: 数据:线程属性、怎么使用cpu;线程控制数据。 算法:解决什么问题; 并行:通信、同步与协作。 阅读全文
posted @ 2018-01-19 17:04 zzfx 阅读(125) 评论(0) 推荐(0)
摘要: In computer science, the event loop, message dispatcher, message loop, message pump, or run loop is a programming construct that waits for and dispatc 阅读全文
posted @ 2018-01-19 16:23 zzfx 阅读(196) 评论(0) 推荐(0)
上一页 1 ··· 71 72 73 74 75 76 77 78 79 ··· 102 下一页