On 12 October 2010 10:51, Michael Schnell <[email protected]> wrote:
>
> So -> OP:
> does it work decently in Linux ?

No!  No matter where I call MyThread.WaitFor() I get a instand
deadlock under Linux. I had to reintroduce a FPC only WaitFor method
in a TTHread descendant, that instead uses the Finised boolean
variable. A virtual Execute() method is also implemented that uses a
interface object to initially set Finised to False, and then when that
interface goes out of scope (when Execute is completed), it
automatically sets Finished to True.  So my reintroduced WaitFor is
implemented as follows:

procedure  TMyBaseThread.WaitFor;
begin
  while not FFinished do CheckSynchronize(100);
end;

Unfortunately WaitFor is not virtual, so I had to use reintroduce, and
wrapped in in IFDEF FPC because Delphi doesn't require this.

I actually think my solution should be the default implementation for
TThread.WaitFor() in FPC - this will prevent deadlocks under platforms
other than Windows.


-- 
Regards,
  - Graeme -


_______________________________________________
fpGUI - a cross-platform Free Pascal GUI toolkit
http://opensoft.homeip.net:8080/fpgui/

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to