• 11396阅读
  • 3回复

qt线程的挂起和恢复 [复制链接]

上一主题 下一主题
离线leafye
 
只看楼主 倒序阅读 楼主  发表于: 2010-09-02
— 本帖被 XChinux 执行加亮操作(2010-09-02) —
在Qt下能不能像C++那样SuspendThread(),ResumeThread()挂起和恢复线程呀。
QThread中的wait()和sleep()感觉都不能实现线程的挂起和恢复。那位大虾能帮忙解决下呀?现在这里谢过。
离线dbzhang800

只看该作者 1楼 发表于: 2010-09-02
1. 据我所知,标准 C++ 并不支持线程吧,你提到的这两个是?
2. 既然你在C++下可以用这两个函数,在Qt下继续用就是了
离线leafye
只看该作者 2楼 发表于: 2010-09-03
Re:QT下如何控制线程
不好意思,我说错了,上面两个函数是windows系统提供的。
我现在在开发的QT程序是要在Linux和windows系统都能运行的。
离线dbzhang800

只看该作者 3楼 发表于: 2010-09-03
UI, Win32, and OS/2 all have a function to force a thread to suspend its execution for an arbitrary length of time and a second function to cause the thread to resume (e.g., in UI, thr_suspend() and thr_continue()).

These functions were included for the purpose of allowing such things as garbage collectors and debuggers to gain full control of a process. As such, they are useful, however for almost any other purpose they are the wrong thing. Because a suspended thread may hold locks that a controller thread needs, it is almost impossible to use them
effectively.

POSIX does not include them in its API. Instead it allows the vendors to write private versions of these functions in the vendor’s debugging interface.
快速回复
限100 字节
 
上一个 下一个