[fpc-devel] StdOut capture for FPC RTL

Thaddy thaddy at thaddy.com
Thu Nov 25 09:37:43 CET 2010


> No, it will not be thread-safe. You'll have to do it over and over 
> again for
> each thread.
>
>> I have some code by Peter Below on archive for that, that also works 
>> on FPC win. The implementation part of that unit can be adapted for 
>> nixen.
>> the file is called streamio.pas and can be easily found on the 
>> codegear website, but I will be happy to send it to you if you want 
>> by email.
>
> The same unit and implementation exists in FPC since years. You can 
> assign any classical pascal textfile to an arbitrary TStream descendent.
>
> Michael.
It is not the same - it is just called the same - but can render the 
same effect.
Which also means that it looks like it only takes some normal 
precautions for threads, otherwise the whole console IO system wouldn't 
be usable with threads.
I guess Marco is right: Just flush after thread operations.
On its own it is not threadsafe, I agree, but it might be a simple and 
solid solution. *without* the rewrites :)




More information about the fpc-devel mailing list