Sign in Join

Live chat for Free Pascal, Lazarus, Delphi and every Pascal programmer.

Mailing lists / fpc-devel / 2005-11

Problems with Threads

2 messages · 2 people ·

Reply by email Subscribe to this list Your subscription

Read-only archive. Use j and k to move between messages.

Felipe Monteiro de Carvalho

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

Reply by email

Bogusław Brandys
to Felipe Monteiro de Carvalho
Felipe Monteiro de Carvalho wrote 46 lines
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

latest subversion lazarus + latest subversion FPC 2.0.3

Regards
B.Brandys

Reply by email