[vte/vte-0-34] [stream] Use unlocked stdio when available



commit ed5adb65a132b1c0e5054618fc989f76955a7e00
Author: Behdad Esfahbod <behdad behdad org>
Date:   Mon Sep 30 00:25:14 2013 -0400

    [stream] Use unlocked stdio when available

 configure.ac         |    2 +-
 src/vtestream-file.h |    7 ++++++-
 2 files changed, 7 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index a2e0c37..faa551a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -222,7 +222,7 @@ AC_HEADER_TIOCGWINSZ
 AC_CHECK_FUNCS([cfmakeraw fork setsid setpgid getpgid getpt grantpt unlockpt posix_openpt ptsname ptsname_r 
tcgetattr tcsetattr])
 
 # Misc I/O routines.
-AC_CHECK_FUNCS([pread pwrite])
+AC_CHECK_FUNCS([pread pwrite fwrite_unlocked])
 
 # Pull in the right libraries for various functions which might not be
 # bundled into an exploded libc.
diff --git a/src/vtestream-file.h b/src/vtestream-file.h
index 8f705e2..e9d8d77 100644
--- a/src/vtestream-file.h
+++ b/src/vtestream-file.h
@@ -194,7 +194,12 @@ _file_write (_file_t *f, const char *data, gsize len, gsize offset)
 
 #include <stdio.h>
 
-/* TODO use unlocked versions. */
+/* Use unlocked versions if available. */
+#ifdef HAVE_FWRITE_UNLOCKED
+#      define fwrite   fwrite_unlocked
+#      define fread    fread_unlocked
+#      define fflush   fflush_unlocked
+#endif
 
 typedef struct
 {


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]