Ӧ
Computer Applications
1999 198 Vol.19No.8 1999



Delphi 3.0еĶ̱̼߳
졡Թ졡
1ǰ
Windows95ǻ̵߳Ķϵͳ֧ʽĶƣһǻڽ̵ģҲWindowsһʼֵ֧Ķִָ͡ŵĳڻڽ̵Ķ񻷾£ԲִСڶֶǻ̵߳ġ߳ǽ̵һִ߳̿ԲִͬһСDelphi3.0Windows95Ķ̻߳ƶṩ˶̵̱֧֣߳ҲDelphi3.0Delphi1.0ش֮һֻܱдܸЧĳ
Ȼ߳̿ԲִͬһУôЭִ̼߳˳ԱٽԴʹöͻʮҪ
2Delphi3.0̶߳
Windows95ϵͳ£д̵߳ĳӦóӿںAPIҲʹDelphi3.0̶߳TThread󣩡̶߳ʹд̳߳򵥡Ч׶̶߳TThread)ṩԺͷԱֻҪҪЩͷдͿڳʵֶ̻߳ơTThreadķԽ
2.1̶߳
Free on Teiminateԣֻͣʱʹá߳̽ʱԾVCLӹԶ̶߳ԼΪTrueʱԶĬֵΪFalse
Thandleԣ߳̾APIд̺߳Ҫʹøþ
Priority:̵߳ȼԣֻʱʹã
RetuinValueԣܱͣ
Protectedָʾ̵ִ߳гɹ
Suspendedԣͣھ߳Ƿ𣬵ֵΪTrueʱ̡߳
Teuminatedԣܱͣ(Protected)ֻԾ߳ǷִֹͣУֵΪTrueʱִ߳н
Thread IDԣ̱߳ʶеAPI̺߳ʹøñʶ
2.2̶߳ķ
̶߳ķкܶ࣬ܳõļַ£
Do Teiminateù̶ֻ߳ڲãVCL̵߳ͬOnteiminate¼һ˵ֹ߳ʱ̻߳Զø÷Ҫд롣
Execute̡÷ʼһ̵ִ߳У߳Удụ̀Executeʱ̵ִֹ߳Сͷ߳ռԴOnteinate¼̡ExecuteԵؼTeiminateԣһΪTrueExecuteء
Resume̡÷ָһ̵ִ߳С
Suspend̡÷һ̵ִ߳УRosumeԵġ
Synchronize̡Delphi3.0Ķ̱߳УVCLٽԴֻ߳ʹã߳ҪʹЩVCLʹSynchronize߳VCLĳͻù̴һTThreadMethod͵Ĳ
Teiminate̡÷TeiminatedΪTrue̵ִֹ߳С
WaitFor÷ȴִ߳еֹȻ󷵻ReturnValueԵֵˣڵøú󣬱ȷ̵߳˳⣬߳ʹSynchronizeҪ߳еWait ForΪһEthreadķ
Onterminate̡ùOnterminate¼Onterminate¼̵߳ExecuteѾأTThread֮߳ǰ¼ֻ߳ʹãԵøVCLԡ
3Delphi3.0е̶߳
Delphi3.0У̶߳ʼӶTobjectֱ࣬Delphi3.0ͶͬڳֱʹãTThreadвһ࣬еĳЩԱдԸǣOverrideTThreadеķԼĹܡDelphi3.0пֱд봴Լ߳࣬ҲܺDelphi3.0߳ԭʼĹô룬ڴ˻޸ġ
4̵ֹ߳ȼ
̵ֹ߳߳еĩ㣬̵߳ڻĸ״̬ͻָ
4.1̵߳
Ϊһ߳һͿʼִС̱߳󣬴ڹ״ִ̬УҪִУ̵߳ResumeΪʲôĹ캯йء
4.2̵ֹ߳
̵ֹ߳Ϊ¼һΪȻִֹ߳󶯽̣߳Ϊǿִֹ߳ʱǿƵ̵߳TerminatẹΪִ߳зEthreadӶ̵̵ֹ߳߳Execute֮󣬵֮߳̽ǰ̵߳Onteiminate̡ 
4.3̵߳Ĺͻָ
̵ִ߳еУǿͨSuspendSuspendedΪTrue̵ִͣ߳УԼCPUʱԼ̵ִ߳Уǵ̵߳Resumeʱ̵ִָֻ߳С
4.4̵߳ȼ
ÿһ̶߳һȼ̵߳ȼȷ̶߳CPUʱĻ̵֣߳ȼ̵߳Priorityá
Delphi3.0ThreadPriorityöͶȼпֵܵ
tpIdle̵߳ȼֻеϵͳʱȼ̲߳űִС
tpLowestȼȼtpNormal2㡣
tpNormalȼ
tpHigherȼȼһ㡣
tpHighestȼȼ2㡣
tpTimeCritical̵߳ȼ
5
delphi3.0ʵֶ̱߳Ǽͷģѿص߳Executeϣ˺ͲϵͳĹĽڽϸһĲʵ˶̡̱߳
ߵλ졡ΫߵרѧУϵɽΫ(261041)
Թ졡ɽʡˮϰ졡ɽ(250013)
ո:1999-02-02
