delphi 優先級和時序安排

進程的優先級別
Win32支持4种不同的優先級類:
Idle,Normal,High,Realtime
要動態的獲取或設置一個進程的優先級類,可以分別調用
GetPriorityClass()函數和SetPriorityClass()函數
function GetPriorityClass(hProcess:THandle):DWORD;stdcall;
function SetPriorityClass(hProcess:THandle;dwPriorityClass:DWORD):BOOL;stdcall;
hProcess參數用於指定一個進程的句柄,可以配合GetCurrentProcess()函數使用
如要把一個進程的優先級類設為High,可以
if not SetPriorityClass(GetCurrent,HIGH_PRIORITY_CLASS) then
  showmessage('Error setting priority class.');

備註 
    GetCurrentProcess()函數是一個返回當前進程的句柄(Win32 API中有關進程的函數)

相對優先級
  一個綫程的相對優先級可以有7种:
  Idle,Lowest,Below Normal,normal,above normal,highest和Time Critical
  TThread中聲明了一個枚舉類型叫TThreadPriority
  type
     TThreadPriority=(Idle,Lowest,Below Normal,normal,above normal,highest和Time Critical);
通過TThread的Priority特性,可以獲取或設置一個綫程的相對優先級
MyThread.Priority := tpHightest 

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值