Chinaunix

标题: fsync 与 撤销点 [打印本页]

作者: peidright    时间: 2010-06-29 00:26
标题: fsync 与 撤销点
fsync
This function is a cancellation point in multi-threaded programs. This is a problem
if the thread allocates some resources (like memory, file descriptors, semaphores or
whatever) at the time fsync is called. If the thread gets canceled these resources stay
allocated until the program ends. To avoid this, calls to fsync should be protected
using cancellation handlers.


这里大概说的是一个这样的问题,如果线程申请了一些资源,当进行fsync调用的时候,如果线程收到取消信号, 则这些资源,
只有当程序结束,才能自动释放? 后面的意思,是什么呢? 没明白,正确的代码,应该如何写呢?。。{:3_184:} ,英文不怎么过关,见笑了。。
作者: peidright    时间: 2010-06-29 10:03
结贴
调用fsync的时候
在cancellation handlers中,不能随意释放资源?
比如不能吧一个fd close..




欢迎光临 Chinaunix (http://bbs.chinaunix.net/) Powered by Discuz! X3.2