Eric Hodel
12/6/2004 8:08:00 PM
On 06 Dec 2004, at 08:07, Lionel Thiry wrote:
> Eric Hodel wrote:
>> On 04 Dec 2004, at 08:02, Lionel Thiry wrote:
>>>> No, system does not block other ruby threads.
>>>
>>> Thanks for the remark... I was a bit confused about my
>>> interpretation of the answer, and I could not test system("sleep
>>> 10000") on my windows2k to see how it works.
>> Maybe only on (some) windows builds it blocks? I no longer have a
>> windows machine handy to test these things on.
> I haven't correcly explained. On my w2k, the sleep command simply
> doesn't exists, then I couldn't test that ruby code. And I have no
> clue about a substitute.
Yes, I know.
>>>> $ cat x.rb
>>>> STDOUT.sync = true
>>>
>>> I didn't know that stuff!
>>> It's interesting, where is that documented?
>> ri has it:
>> $ ri IO#sync
> Oh yes! I forgot STDOUT was simply an IO object.
> But why do we need it here?
To be explicit and to behave as expected when you run it on a machine
with sleep. Without it, the OS may buffer the printing, and flush when
the program exits (all 10 lines at once). This would give the
appearance that system() blocked the Ruby thread.