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
Is writeln thread safe? I’m getting some strange crashes and I’m curious if
they’re related to calling writeln on multiple threads.
Regards,
Ryan Joseph
___
fpc-pascal maillist - fpc-pascal@lists.freepascal.org
http://lists.freepascal.org/cgi
> > 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
> Please post the complete code.
Here goes (Typed from my Linux box, as i don't have filesharing going
there):
< Start Unit1
Unit unit1;
{$mode objfpc}{$H+}
Interface
Uses
Classes, SysUtils;
Type
threadtest = class(tthread)
constructor Create;
procedure Execute: override;
End
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:
>
>
>> -Opprinnelig melding-
>> Fra: [EMAIL PROTECTED]
>> [mailto:[EMAIL PROTECTED] På vegne av
>> Florian Klaempfl
>> Sendt: 2. juli 2006 12:46
>> Til: FPC-Pascal users discussions
>> Emne: Re: [fpc-pascal] wri
> -Opprinnelig melding-
> Fra: [EMAIL PROTECTED]
> [mailto:[EMAIL PROTECTED] På vegne av
> Florian Klaempfl
> Sendt: 2. juli 2006 12:46
> Til: FPC-Pascal users discussions
> Emne: Re: [fpc-pascal] writeln in threads on linux
>
> > And if this is a &
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
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:
Inside Thread
Main Loop
Inside Thread
Main
10 matches
Mail list logo