summaryrefslogtreecommitdiff
path: root/lib/mbtowc-lock.h
diff options
context:
space:
mode:
Diffstat (limited to 'lib/mbtowc-lock.h')
-rw-r--r--lib/mbtowc-lock.h12
1 files changed, 11 insertions, 1 deletions
diff --git a/lib/mbtowc-lock.h b/lib/mbtowc-lock.h
index 320613eae..093951713 100644
--- a/lib/mbtowc-lock.h
+++ b/lib/mbtowc-lock.h
@@ -32,7 +32,17 @@ mbtowc_unlocked (wchar_t *pwc, const char *p, size_t m)
/* Prohibit renaming this symbol. */
#undef gl_get_mbtowc_lock
-#if defined _WIN32 && !defined __CYGWIN__
+#if GNULIB_MBRTOWC_SINGLE_THREAD
+
+/* All uses of this function are in a single thread. No locking needed. */
+
+static int
+mbtowc_with_lock (wchar_t *pwc, const char *p, size_t m)
+{
+ return mbtowc_unlocked (pwc, p, m);
+}
+
+#elif defined _WIN32 && !defined __CYGWIN__
extern __declspec(dllimport) CRITICAL_SECTION *gl_get_mbtowc_lock (void);