On 17/02/17 12:43, Ryan Joseph wrote:
Is writeln thread safe? I’m getting some strange crashes and I’m curious if
they’re related to calling writeln on multiple threads.
Unlikely. The output from different threads can be mixed at weird places
since it all goes to the same file handle and buff
> Is writeln thread safe?
In console application, IMHO yes.
But If you use writeln in a Windows environnement or with LCL widget, it
could not be safe.
Fre;D
-
Many thanks ;-)
--
View this message in context:
http://free-pascal-general.1045716.n5.nabble.com/Writeln-in-threads-tp5727683p5
> > And if this is a "wrong way" of doing this thing, could someone tell me how
> > it should be..
>
> You probably want to guard the output with mutexes or semaphores.
> Writing unsynchronized to a stream has always unexpected results.
Even then it won't necessarily work. textrec threadvar prob
Could we see the complete code please...
Graeme.
On 7/2/06, Ole J. Røtne <[EMAIL PROTECTED]> wrote:
Did try to wrap both of the WriteLn() with
EnterCriticalSection/LeaveCriticalSection.
Same result..
--
There's no place like 127.0.0.1
___
fpc-pasc
Ole J. Røtne wrote:
>
> Can anyone explain why i get output like this in a small test program:
> Inside Thread
>Main Loop
> Inside Thread
>Main Loop
> Inside Thread
>Main Loop
>
>
> On Windows the output are lined up just as I would expect:
> Insi