[Lazarus] making multithreading more user friendly

Mattias Gaertner nc-gaertnma at netcologne.de
Sat Apr 28 19:26:40 CEST 2012


On Sat, 28 Apr 2012 11:43:31 +0200
Giuliano Colla <giuliano.colla at fastwebnet.it> wrote:

> Il 28/04/2012 10:21, Mattias Gaertner ha scritto:
> > On Sat, 28 Apr 2012 01:24:03 +0200
> > Giuliano Colla<giuliano.colla at fastwebnet.it>  wrote:
> >
> > [...]
> >> I could provide a patch if pointed to the right area of code to deal
> >> with. IDE things remain a big mystery to me.
> > AFAIK the real pain is to find the cause of the strange/misleading
> > error messages. The remedy itself is pretty simple (a flag or a tiny
> > code change).
> >
> 
> The problem arises from TThread being in fpc rtl, which is of course 
> unaware of Lazarus needs.

This is not Lazarus specific.
A console application gets the same error.


>[...]
> constructor TCDX11TimerThread.Create(CreateSuspended: Boolean;
>    const StackSize: SizeUInt);
> var
>    thisTM: TThreadManager;
> begin
>    GetThreadManager(thisTM);
>    if not Assigned(thisTM.InitManager) then begin
>      Raise Exception.Create
>      ('You must define UseCThread (-dUseCThreads in Project Options->  Compiler Options) in order to run this program!');
>      end;
>    inherited Create (CreateSuspended);
>    [..]
> 
> A LazThread class defined in LCL which wraps  TThread and performs 
> appropriate checks could be a solution?

The above check can be used to improve the semaphore message of the RTL.

Mattias




More information about the Lazarus mailing list