Hi all,
I got a bit of an issue. I am running the latest fpc and lazarus. I created a very simple thread and it just won't start NO MATTER what I do. However, I ran the example multithreaded program for lazarus and that does run. I compared my thread program to the example and I can't find anything wrong. The only difference is the Execute method everything else is the same. I am working on the Linux System. So, why can't I create and run my thread? Can someone please help me? thank you.
1.) I did make sure that
cthreads is included in my lpr file.
{$IFDEF UNIX}{$IFDEF UseCThreads}
cthreads,
{$ENDIF}
2.) the code is as follows
uses
Tmythread = class(TThread)
protected
procedure Execute; override;
public
constructor create(createsuspended:boolean);
end;
var
mythread:Tmythread;
procedure Tmythread.Execute;
begin
//Do something
end;
procedure TmyThread.Create(createsuspended:boolean);
begin
FreeonTerminate:=true;
inherited Create(createsuspended);
end;
procedure TForm1.Create(sender:TObject);
begin
mythread := Tthread.create(true);
mythread.start;
end;