[fpc-devel] Problems with Threads

Felipe Monteiro de Carvalho felipemonteiro.carvalho at gmail.com
Sun Nov 20 10:45:35 CET 2005


Hello,

I am having problems with a multi-threaded application. It crashes on
Windows. Upon startup the program creates a secondary thread with
CreateSuspended := True

Then, when pressing a button, the thread is resumed. I changed the
Execute method of the thread to find the problem. Now it is only:

procedure TMedidor.Execute;
begin
  while (not Terminated) do
  begin
    Self.Suspend;
  end;
end;

On Linux the program works perfectly, but on Windows it will load,
appear normal, but when I click the button it crashes!!

The button code is only: vMedidor.Resume;

I tryed to create a new empty program with just one button and see if
the problem happens, but seams not to happen. o.O .... the problem seams
only to happen on the whole program.

On linux I am using the cthreads unit. Should I use something special on
Win32??? I read about a {$THREADING ON} or something like that while
searching the archives.

any ideas??

The only thing I can think of right now is rewriting the program to use
Windows API to create the thread to try to find out if the program is my
project or TThread class.

thanks,

Felipe

PS: I am posting here because I posted on Lazarus mailling list and
was told to repost here because this is more of a FPC problem

PS2: I tested on two different configurations:

latest subversion lazarus + FPC2.0.0

Lazarus 0.9.10 + It´s FPC



More information about the fpc-devel mailing list