孤
孤云
Unregistered / Unconfirmed
GUEST, unregistred user!
Unit UTHREAD;
interface
USES
Classes,Math,SysUtils,DateUtils;
TYPE
TInOPTThread=class(TThread)
private
{....}
protected
proceduredo
InOPT;
procedure Execute;
override;
public
{....}
constructor Create(CreateSuspended:Boolean);
end;
implementation
CONSTRUCTOR TInOPTThread.Create(CreateSuspended:Boolean);
begin
FreeOnTerminate := True;
inherited Create(CreateSuspended);
end;
PROCEDURE TInOPTThread.Execute;
begin
FreeOnTerminate:=True;
WHILE Truedo
begin
IF Terminated then
Break;
Synchronize(DoInOPT);
end;
end;
PROCEDURE TInOPTThread.DoInOPT;
begin
........//执行部分
........
end;
end.
Unit Unit1
。。。。。
implementation
use UTHREAD;
procedure start;
begin
.......
.......
TInOPTThread.Create(True);//跟踪调式时,在这和线程中的DoInOPT设置断点,
程序执行到这的时候直接跳过去,执行下面分部分
不见DoInOPT的程序执行
.......
.......
end;
请问怎么才能正确启用线程,并让线程的DoInOPT部分执行,谢谢!
interface
USES
Classes,Math,SysUtils,DateUtils;
TYPE
TInOPTThread=class(TThread)
private
{....}
protected
proceduredo
InOPT;
procedure Execute;
override;
public
{....}
constructor Create(CreateSuspended:Boolean);
end;
implementation
CONSTRUCTOR TInOPTThread.Create(CreateSuspended:Boolean);
begin
FreeOnTerminate := True;
inherited Create(CreateSuspended);
end;
PROCEDURE TInOPTThread.Execute;
begin
FreeOnTerminate:=True;
WHILE Truedo
begin
IF Terminated then
Break;
Synchronize(DoInOPT);
end;
end;
PROCEDURE TInOPTThread.DoInOPT;
begin
........//执行部分
........
end;
end.
Unit Unit1
。。。。。
implementation
use UTHREAD;
procedure start;
begin
.......
.......
TInOPTThread.Create(True);//跟踪调式时,在这和线程中的DoInOPT设置断点,
程序执行到这的时候直接跳过去,执行下面分部分
不见DoInOPT的程序执行
.......
.......
end;
请问怎么才能正确启用线程,并让线程的DoInOPT部分执行,谢谢!