Tango I/O bug?

Sean Kelly sean at f4.ca
Tue Sep 18 14:12:30 PDT 2007


For what it's worth, flush() merely writes all data buffered by Tango to 
the underlying device.  On non-Win32 platforms, there is no actual 
kernel call performed to force an immediate flush of the data to 
wherever.  Is it possible that OSX does buffering within the kernel and 
the data is lingering in there?  And if so, do you know of a routine 
that could be called to perform a hard flush?  Typically, the commit() 
method is used for this purpose, but it's empty on Posix systems right now.

Jason House wrote:
> Given that enabling a flush doesn't solve the problem, what is the path forward for figuring out how to fix this?  It works on all other systems tested with dmd, but doesn't work on mac (with gdc).  (I've had big problems getting gdc and tango to play nicely with each other in a cygwin environment, but that's probably another thread)
> 
> Jason House Wrote:
> 
>> Sadly, this simple fix isn't the solution.  Here's what I got back (via e-mail)...
>>
>>> This part is likely your problem: "It does real time communication in
>>> plain text with a 3rd party controlling application"
>>> That probably means the output is redirected and not sent to an actual
>>> console, right?
>>> The default behavior for Stdout is to auto-flush only if the output is
>>> sent to an actual console (i.e. isn't redirected).
>> Well, it is sent to an actual console. I mean I just start housebot
>> by hand
>> and interact with it.
>>
>>> To make sure flushing occurs, execute "Stdout.flush = true;" somewhere
>>> at the start of your program (main(), a static this(), or just right
>>> before the first output).
>> I tried that. I added the import for tango.io.Stdout to housebot.d
>> and added
>> "Stdout.flush = true;" at the beginning of main(), just after the
>> variable
>> declarations. But nothing changed.
> 


More information about the Digitalmars-d-learn mailing list