社区
Linux/Unix社区
帖子详情
pthread_cleanup_push的小问题?
yjdabc
2010-07-07 01:19:53
学习APU线程一章,代码
编译出现如下错误:
不理解这是怎么回事,请大家看看,谢谢!
...全文
63
4
打赏
收藏
pthread_cleanup_push的小问题?
学习APU线程一章,代码 编译出现如下错误: 不理解这是怎么回事,请大家看看,谢谢!
复制链接
扫一扫
分享
转发到动态
举报
写回复
配置赞助广告
用AI写文章
4 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
angecycy
2010-07-09
打赏
举报
回复
1.At weekends,she often helps her mother do some cleaning.为何"clean"要加"ing"?2.求"征询网友"的各种写法.
brookmill
2010-07-07
打赏
举报
回复
从gcc报的错误来看,他认为到了第22行fn_l这个函数还没有结束,原因就是少了个 }while(0);
gcc把pthread_clean_pop(0)当成了一个函数调用,而且很可能给了它一个默认声明。
如果gcc -Wall,会有类似这样的一个警告:
warning: implicit declaration of function pthread_clean_pop
brookmill
2010-07-07
打赏
举报
回复
19行应该是pthread_cleanup_pop
pthread_cleanup_push 是个宏, do { ...
pthread_cleanup_pop 也是个宏, ... } while (0);
这两个如果没有配对使用,结果就会有一个 do 找不到对应的while
楼主可以自己看看pthread.h里面的定义,或者看看gcc -E宏替换之后的结果。
yjdabc
2010-07-07
打赏
举报
回复
难道没有人知道?
linux p
thread
_
cleanup
_
push
线程实现,关于 p
thread
_
cleanup
_
push
的
问题
关于 p
thread
_
cleanup
_
push
有如下描述:================================从p
thread
_
cleanup
_
push
()的调用点到p
thread
_
cleanup
_pop()之间的程序段中的终止动作(包括调用p
thread
_exit()和取消点终止)都将执行p
thread
...
linux下p
thread
_
cleanup
_
push
和p
thread
_
cleanup
_pop
p
thread
_
cleanup
_
push
的使用 该函数为当前的线程注册一个清理回调函数,清理函数在使用
push
的时候压入线程的一个栈中。 那么该清理函数何时会被调用呢? 记住,p
thread
_
cleanup
_
push
必须和p
thread
_
cleanup
_pop同时...
C语言 p
thread
_
cleanup
_
push
()和p
thread
_
cleanup
_pop()函数(用于临界资源程序段中发生终止动作后的资源清理任务,以免造成死锁,临界区资源一般上锁)
brief在POSIX线程API中提供了一个p
thread
_
cleanup
_
push
()/p
thread
_
cleanup
_pop()函数对用于自动释放资源--从p
thread
_
cleanup
_
push
()的调用点到p
thread
_
cleanup
_pop()之间的程序段中的终止动作(包括调用p
thread
_exit...
linux线程间的通信(p
thread
_
cleanup
_
push
和p
thread
_
cleanup
_pop,p
thread
_join,p
thread
_detach)
线程可以安排他退出时需要调用的函数,这与进程可以用...p
thread
_
cleanup
_
push
和p
thread
_
cleanup
_pop函数原型如下: 头文件:#include <p
thread
.h> 函数原型:void p
thread
_
cleanup
_
push
(void (*rtn)(vo...
linux线程间的通信(p
thread
_
cleanup
_
push
和p
thread
_
cleanup
_pop)
linux高级编程之线程间的通信(p
thread
_
cleanup
_
push
和p
thread
_
cleanup
_pop) 线程可以安排他退出时需要调用的函数,这与进程可以用atexit函数安排进程退出时需要调用的函数是类似的。这样的函数称为线程清理...
Linux/Unix社区
23,116
社区成员
74,506
社区内容
发帖
与我相关
我的任务
Linux/Unix社区
Linux/Unix社区 应用程序开发区
复制链接
扫一扫
分享
社区描述
Linux/Unix社区 应用程序开发区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章