社区
Linux_Kernel
帖子详情
Linux下面如何实现挂起和恢复一个线程?
rainfate
2004-11-23 05:17:20
作用相当于windows下面的suspendthread()和resumethread()?
有没有封装好的函数可以使用呢?
还是使用信号?
...全文
429
7
打赏
收藏
Linux下面如何实现挂起和恢复一个线程?
作用相当于windows下面的suspendthread()和resumethread()? 有没有封装好的函数可以使用呢? 还是使用信号?
复制链接
扫一扫
分享
举报
写回复
配置赞助广告
用AI写文章
7 条
回复
切换为时间正序
请发表友善的回复…
发表回复
打赏红包
xu123
2004-12-02
打赏
举报
回复
学习...
rainfate
2004-11-26
打赏
举报
回复
看来是没有象windows封装的那么好的现成的可以用了:)
好了,谢谢各位!
nise
2004-11-26
打赏
举报
回复
用信号或PIPE
pacman2000
2004-11-25
打赏
举报
回复
借助pthread的cond,用pthread_cond_wait()应该可以做到暂停。
vfork
2004-11-25
打赏
举报
回复
wait可以吧!
loveisbug
2004-11-25
打赏
举报
回复
看具体的用处
kingzai
2004-11-23
打赏
举报
回复
#include <pthread.h>
int pthread_create(pthread *tid,const pthread_attr_t *attr,void *(*func)(void *),void *arg);
int pthread_join(pthread_t tid,void **status);
pthread_t pthread_self(void);
int pthread_detach(pthread_t tid);
void pthread_exit(void *status);
pthread多
线程
: 创建,
挂起
,
恢复
, 结束
在
linux
中, 多
线程
库为 pthread, 要包含头文件<pthread.h> 从
一个
最基本的多
线程
程序开始介绍 #include <pthread.h> #include <stdio.h> #include <assert.h> #include <unistd.h> void *child(void *arg) { s...
linux
线程
挂起
恢复
的简单示例
参考: http://blog.csdn.net/chennxi/article/details/6234529《
Linux
下
线程
的
挂起
和
恢复
》 写了个demo: #include #include static pthread_mutex_t mutex; static pthread_cond_t cond; static int flag = 0; void srpthread
Linux
下
线程
的
挂起
和
恢复
下面
的程序本人已经过测试,证明确实可用
----------------------------------------------------------------------------------------------------------
POSIX的
Linux
操作系统没有提供
线程
挂起
和
恢复
的例程,在网上找了找,看到
一个
老外写的程序,感觉想法不错,放在这里大家分享一下。
#include
static pth
linux
线程
的
挂起
和唤醒
#include #include #include #include using namespace std; pthread_t IDA; pthread_t IDB; pthread_mutex_t mut = PTHREAD_MUTEX_INITIALIZER; pthread_cond_t cond = PTHREAD_COND_INITIALIZER; #define
Linux_Kernel
4,469
社区成员
17,458
社区内容
发帖
与我相关
我的任务
Linux_Kernel
Linux/Unix社区 内核源代码研究区
复制链接
扫一扫
分享
社区描述
Linux/Unix社区 内核源代码研究区
社区管理员
加入社区
获取链接或二维码
近7日
近30日
至今
加载中
查看更多榜单
社区公告
暂无公告
试试用AI创作助手写篇文章吧
+ 用AI写文章