Hi

I thought first to send this to Lazarus dev list but it may have wider interest 
so I send it here.

I am going to commit a patch for converter (=part of Lazarus code base) that 
uses TThread. It caches some unit paths in backround so that the converter 
settings dialog appears without delay. After the dialog I just 
"Thread.WaitFor" before starting the conversion. No other synchronization is 
needed. It is a perfect case for using a thread.

Under Linux I got a RunError. I know what it means, I need to use cthreads.
In lazarus.pp unit I found:

  {$IFDEF UNIX}{$IFDEF UseCThreads}
  cthreads,
  {$ENDIF}{$ENDIF}

so I rebuilt Lazarus with -dUseCThreads. Now it works perfectly!

Question: why is there need for "UseCThreads" define. Isn't cthreads needed 
always when using a *nix system? So, can I change the definition to :

  {$IFDEF UNIX}
  cthreads,
  {$ENDIF}

If I now commit my code as it is, there will be complaints from people who run 
the converter under Linux for example.

I was amazed that there isn't a single use of threads in Lazarus code base. 
Threads however are the thing of the future because computers have more and 
more CPU cores. Threads are a way to utilize them.

Juha

--
_______________________________________________
Lazarus mailing list
[email protected]
http://lists.lazarus.freepascal.org/mailman/listinfo/lazarus

Reply via email to