diff options
author | Pete Batard <pbatard@gmail.com> | 2010-02-25 19:36:27 +0000 |
---|---|---|
committer | Pete Batard <pbatard@gmail.com> | 2010-02-25 19:36:27 +0000 |
commit | 778360b4e96090483a655be7b37d2bc4c398353d (patch) | |
tree | 0dba37c4ac1827ca3656fd38ca0e4dc3ba621ff1 /libusb | |
parent | b4859ac74cfb67c36f7f143b65beacc4dded94c7 (diff) | |
download | libusb-778360b4e96090483a655be7b37d2bc4c398353d.tar.gz |
added nonbuffered stdio logging option in compatibility layerr176
Diffstat (limited to 'libusb')
-rw-r--r-- | libusb/os/windows_compat.c | 8 |
1 files changed, 8 insertions, 0 deletions
diff --git a/libusb/os/windows_compat.c b/libusb/os/windows_compat.c index 38e1fb0..848f837 100644 --- a/libusb/os/windows_compat.c +++ b/libusb/os/windows_compat.c @@ -71,6 +71,9 @@ // Uncomment to have poll return with EINTR as soon as a new transfer (fd) is added (EXPERIMENTAL) //#define DYNAMIC_FDS +// Force non buffered stdio for logging +#define NONBUFFERED_STDIO + // Uncomment to debug the polling layer //#define DEBUG_WINDOWS_COMPAT #if defined(DEBUG_WINDOWS_COMPAT) @@ -162,6 +165,11 @@ void init_polling(void) SleepEx(0, TRUE); } if (!is_polling_set) { +#if defined(NONBUFFERED_STDIO) + // Windows's default is to buffer stdio - fix that + setvbuf(stdout, NULL, _IONBF,0); + setvbuf(stderr, NULL, _IONBF,0); +#endif pCancelIoEx = (BOOL (__stdcall *)(HANDLE,LPOVERLAPPED)) GetProcAddress(GetModuleHandle("KERNEL32"), "CancelIoEx"); printb("init_polling: Will use CancelIo%s for I/O cancellation\n", |