English 中文(简体)
协同效应似乎出现在hang子里
原标题:Synchronize appears to hang thread

我有一个信息点,其基础是处理向其传递的信息。 由于在校方的一些活动可能是科索沃法院联盟的指挥,因此这些活动是在协同进行的。 不久,Schronize被称作read。 样本代码:

TMessageQ = class (TThread)
...
procedure TMessageQ.do_msg;
begin
   case CurrentMessage.Command of
      cQSize:  if Assigned (OnSize)  then OnSize  (CurrentMessage);
      cQReady: if Assigned (OnReady) then OnReady (CurrentMessage);
   end; // case
end; // do_msg /

procedure TMessageQ.doTask (Sender: TObject);
begin
   while FQ.Count > 0 do
   begin
      FSection.Enter;
      try
         CurrentMessage := FQ.Dequeue;
      finally
         FSection.Leave;
      end; // try..finally
      Synchronize (do_msg);
   end; // while
end; // doTask //

从来没有处理过任何 do。 有些人知道我做了什么错误?

最佳回答

<代码>TThread.Synchronize(各栏,直至主线处理请求。 主要读物需要一种积极的信号循环,以便处理申请(除非你人工打上<代码>申请)。 ProcessMessages(或CheckSynchronize() 如果总是通过<条码>thread.Synchronize()来援引你的主要工作,那么根本就没有必要使用透镜。 你们只能用时间或习惯的窗口信息,而不是主线,并顾及所有不必要的复杂性。

问题回答

暂无回答




相关问题
determining the character set to use

my delphi 2009 app has a basic translation system that uses GNUGetText. i had used some win API calls to prepare the fonts. i thought it was working correctly until recently when someone from Malta ...

Help with strange Delphi 5 IDE problems

Ok, I m going nuts here. For the last (almost) four years, I ve been putting up with some extremely bad behavior from my Delphi 5 IDE. Problems include: Seemingly random errors in coride50.bpl ...

How to write a Remote DataModule to run on a linux server?

i would like to know if there are any solution to do this. Does anyone? The big picture: I want to access data over the web, using my delphi thin clients. But i´would like to keep my server/service ...

How convert string to integer in Oxygene

In Delphi, there is a function StrToInt() that converts a string to an integer value; there is also IntToStr(), which does the reverse. These functions doesn t appear to be part of Oxygene, and I can ...

Quick padding of a string in Delphi

I was trying to speed up a certain routine in an application, and my profiler, AQTime, identified one method in particular as a bottleneck. The method has been with us for years, and is part of a "...

热门标签