WordCount performance
Frits van Bommel
fvbommel at REMwOVExCAPSs.nl
Thu Mar 27 16:01:27 PDT 2008
Walter Bright wrote:
> Georg Wrede wrote:
>> Hmm. What kind of situations would need multiple threads
>> simultaneously reading from stdin? And if there aren't any, wouldn't
>> locking be like wearing a life vest on land?
>
> If it was unsynchronized, if you had two threads reading lines from the
> input, the contents of the lines would be interleaved. With syncing,
> each thread will get complete lines.
I believe his point was "What kind of program would ever want to do
character-level stdin I/O from multiple threads?"
My follow-up would be: "And if there *is* some exotic program that needs
to do that, why can't you just require it to provide its own damn
locking, and leave the rest of us with faster I/O?" (Of course, I use
Linux, so AFAIK I'm using glibc anyway)
More information about the Digitalmars-d
mailing list