WordCount performance

Georg Wrede georg at nospam.org
Thu Mar 27 18:17:22 PDT 2008


Frits van Bommel wrote:
> 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)

Heck, I just spent ages formulating the same thing. You said it in a 
couple of sentences.



More information about the Digitalmars-d mailing list