C++ Builder 參考手冊 ? System::Classes ? TThread ? SpinWait
頭文件:#include <System.Classes.hpp>
命名空間:System::Classes
類:TThread
訪問權(quán)限:public:
函數(shù)原型:
static void __fastcall SpinWait(int Iterations);
SpinWait 是 System::Classes::TThread 的靜態(tài)成員函數(shù),線程空轉(zhuǎn)暫短的一段時間。
參數(shù):
Iterations:空轉(zhuǎn)循環(huán)次數(shù)嗤朴。
返回值:
無偎箫。
- 暫短的延時徙鱼,與 Sleep 不同缀遍,SpinWait 不要求 CPU 立即切換線程全度,只是當前線程空轉(zhuǎn)一段時間幔妨;
- 用這個方法空轉(zhuǎn)可以降低 CPU 使用率,但是不會像 Sleep 那樣掛起線程不占 CPU 資源傍菇。
相關(guān):
- System::Classes::TThread::Sleep
- System::Classes::TThread::Yield
- System::Classes::TThread::Start
- System::Classes::TThread::Execute
- System::Classes::TThread::Started
- System::Classes::TThread::Terminated
- System::Classes::TThread::Finished
- System::Classes::TThread
- System::TObject
- VCL 類繼承關(guān)系
C++ Builder 參考手冊 ? System::Classes ? TThread ? SpinWait