[Issue 4600] writeln() is not thread-safe
d-bugmail at puremagic.com
d-bugmail at puremagic.com
Wed May 22 23:59:03 PDT 2013
http://d.puremagic.com/issues/show_bug.cgi?id=4600
Jameson <beatgammit at gmail.com> changed:
What |Removed |Added
----------------------------------------------------------------------------
CC| |beatgammit at gmail.com
--- Comment #1 from Jameson <beatgammit at gmail.com> 2013-05-22 23:59:00 PDT ---
(In reply to comment #0)
> Okay. Maybe I misunderstood something somewhere, but as I understand it,
> writeln() is supposed to be thread-safe. Multiple threads can interleave lines
> that they're printing, but each line that a thread prints with writeln() is
> supposed to be completely printed before a line from another thread can be
> printed. However, at least some of the time, the output from one thread is
> mixed with another on the same line. For instance, take this program:
>
> import std.concurrency;
> import std.stdio;
>
> void main(string[] args)
> {
> spawn(&func1, thisTid, args.idup);
> spawn(&func2, thisTid, args.idup);
> writeln("main() 1");
> writeln("main() 2");
> writeln("main() 3");
> }
>
> void func1(Tid parentTid, immutable string[] args)
> {
> writefln("func1() begin");
> writefln("func1(): %s", args);
> writefln("func1() end");
> }
>
> void func2(Tid parentTid, immutable string[] args)
> {
> writefln("func2() begin");
> writefln("func2(): %s", args);
> writefln("func2() end");
> }
I couldn't reproduce this with the current DMD. This issue is quite old, so
it's possibly invalid now.
I'm running Linux x86_64 with DMD 2.062. Also tried ldc2 (targeting DMD 2.061),
no problems.
Can this be closed?
--
Configure issuemail: http://d.puremagic.com/issues/userprefs.cgi?tab=email
------- You are receiving this mail because: -------
More information about the Digitalmars-d-bugs
mailing list