[fpc-pascal] Why is cthreads unit not included by default

Marco van de Voort marcov at stack.nl
Thu Aug 27 12:59:28 CEST 2009


In our previous episode, Graeme Geldenhuys said:
> uses
>   {$IFDEF UNIX}{$IFDEF UseCThreads}
>   cthreads,
>   {$ENDIF}{$ENDIF}
>   Classes;
> ---------------
> 
> Question 1:
>   Is there an alternative implementation of multi-threading support for
> Unix-type systems -- other than the cthreads unit?

Not.
 
> Question 2:
>   If not, then why do we have the extra "IFDEF UseCThreads" define in
> the uses clause?

In case you don't use threads and want to make a static binary.
 
> Why can't we just have the following...? By default Windows programs and
> OS/2 programmes have multi-threading support compiled in, why don't we
> do the same for Unix-type systems? I often get the "program not compiled
> with multi-threading support" error and have to constantly define the
> UseCThreads option.

Because the API model of Unix is totally different from Windows and OS/2.

I do think that if Lazarus has separate templates for "LCL app" and "general
app" that the ifdef could disappear from the LCL app, since that is never
static anyway.
 



More information about the fpc-pascal mailing list