[fpc-pascal] Where is IsMultiThreaded set under Linux?

Michael Van Canneyt michael at freepascal.org
Fri Oct 8 16:22:08 CEST 2010



On Fri, 8 Oct 2010, Graeme Geldenhuys wrote:

> On 8 October 2010 15:57, Andrew Brunner wrote:
>> A better way of achieving this is looking at the collection of threads
>> you have.  Set your own booleans for Finished or if they
>> freeonterminate you will need to create an
>> TCompletes=Array[0..threadcount] of boolean.  And as the threads free
>> set the variable of TCompletes to true.  Then you can poll the
>> Completes to see if they are all true.
>
>
> That comes down to the same thing I have done with the single boolean
> variable. All logging thread classes descend from a base log thread
> class. It's in that base thread class that I implemented the boolean
> variable.
>
>
>> There are a million ways to accomplish safe thread usage without waitfor...
>
> Yes, but my point is that FPC's "single source, compile everywhere"
> doesn't works so well in this case, because TThread.WaitFor works
> completely different under Windows to what it currently does under
> Unix/Linux. So the code now has to contain IFDEF's - which all tiOPF
> team members hate.

It is impossible to make it work like Windows, since other OSes simply
do not have a single event queue (as mentioned by Sergei Gorelkin).

Rather, one should not take Windows as the reference platform, something
that the tiOPF developers do. Doing so will always create problems.

I strongly suspect that the code will also not function on windows if you 
have a windows non-gui, non-event based program, but that would have to be
investigated.

Michael.


More information about the fpc-pascal mailing list