程序结果如下:对一个文本文件分析并导入数据库的过程。
_main
begin
proginit;//初始化进度条
formreset;//设置窗体
new Thread;//打开一个线程处理一个文本。
end//线程定义
Thread;
begin while(eof = true) begin
readline ;//读一行
insertdataserver;//单条插入数据库
fleshprog;//刷新进度条
Application.processmassage;//处理WINDOWS消息
end;
formreset;//重置窗体
stoped;//执行一次结束线程
end;——————如上:
程序结构就是这样,文本文件一大,程序界面就会出现不响应的现象(假死机),查看数据库的时候,看到程序在运行,但是进度条走到百分之几的时候就不走了,按纽也按不动。等很长一段时间后,处理结束了。程序又恢复了正常。我看到kingdee的系统的数据库操作的时候,很繁忙人家都不会假死机呢。
_main
begin
proginit;//初始化进度条
formreset;//设置窗体
new Thread;//打开一个线程处理一个文本。
end//线程定义
Thread;
begin while(eof = true) begin
readline ;//读一行
insertdataserver;//单条插入数据库
fleshprog;//刷新进度条
Application.processmassage;//处理WINDOWS消息
end;
formreset;//重置窗体
stoped;//执行一次结束线程
end;——————如上:
程序结构就是这样,文本文件一大,程序界面就会出现不响应的现象(假死机),查看数据库的时候,看到程序在运行,但是进度条走到百分之几的时候就不走了,按纽也按不动。等很长一段时间后,处理结束了。程序又恢复了正常。我看到kingdee的系统的数据库操作的时候,很繁忙人家都不会假死机呢。
begin
SetName;
while not Terminated do
begin
Synchronize(InOutStore); //同步化机制.. /////////////////这儿用了Synchronize的
end;
{ Place thread code here }
end;procedure InOutStoreThread.InOutStore;
begin
//添加出入库的代码
try
frmInStorePager.Enabled :=false; if (g_TypeCode <> 'I' ) and (g_typecode<> 'B') then
frmInStorePager.FileOutStore(frmInStorePager.InOutID.IntValue)
else
frmInStorePager.FileInStore(frmInStorePager.InOutID.IntValue);
finally
frmInStorePager.Enabled := true;
end;Terminate; //运行一次终止线程
end;