Re: race condition (sort of)? message box verus function return
Jonathan Dearborn <[email protected]> Mon, 13 Feb 2017 13:20:48 -0500
| Newsgroups | gmane.comp.lib.sdl |
|---|---|
| Message-ID | <CA+DSiHbthMi0J5V6qu+qJxWWWkA8WzAbKzWQKHOCMop-J4Y5cA@mail.gmail.com> |
It doesn't speed anything up. There's also no race condition, because these commands are all done on a single thread. Output streams write to a memory buffer. That memory buffer needs to be flushed so that it is actually sent to the output device (which could be anything, not just a simple terminal). C and C++ separate writing and flushing to give you more control. If you don't care about that control, just use std::endl to write a newline and force a flush. Jonny D On Mon, Feb 13, 2017 at 12:24 PM, speartip <[email protected]> wrote: > Hi, > > Thank you for the solutions, they all worked. Of all the combinations I > tried, the one below worked the best: > > > > > Code: > > > std::cout<< horizontal <<"\t"< > > > > Generally speaking, why did flushing the stream and combinations, etc., > work to speed up the routine? > > _______________________________________________ > SDL mailing list > [email protected] > http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org > > _______________________________________________ SDL mailing list [email protected] http://lists.libsdl.org/listinfo.cgi/sdl-libsdl.org