提交 6650b710 编写于 作者: S Stefan Weil 提交者: Blue Swirl

win32: Set unbuffered stdout

Win32 does not support line-buffering, but it allows
unbuffered output.

Unbuffered output is a good approximation. For typical output
statements which usually end with '\n', it's even identical.

Buffered output is unusable for program traces because of
its large delay.

Cc: Blue Swirl <blauwirbel@gmail.com>
Signed-off-by: NStefan Weil <weil@mail.berlios.de>
Signed-off-by: NBlue Swirl <blauwirbel@gmail.com>
上级 ea95f156
......@@ -221,6 +221,12 @@ char *os_find_datadir(const char *argv0)
return NULL;
}
void os_set_line_buffering(void)
{
setbuf(stdout, NULL);
setbuf(stderr, NULL);
}
/*
* Parse OS specific command line options.
* return 0 if option handled, -1 otherwise
......
......@@ -45,8 +45,7 @@ void os_host_main_loop_wait(int *timeout);
static inline void os_setup_signal_handling(void) {}
static inline void os_daemonize(void) {}
static inline void os_setup_post(void) {}
/* Win32 doesn't support line-buffering and requires size >= 2 */
static inline void os_set_line_buffering(void) {}
void os_set_line_buffering(void);
static inline void os_set_proc_name(const char *dummy) {}
#if !defined(EPROTONOSUPPORT)
......
Markdown is supported
0% .
You are about to add 0 people to the discussion. Proceed with caution.
先完成此消息的编辑!
想要评论请 注册