+// © 2016 and later: Unicode, Inc. and others.
+// License & terms of use: http://www.unicode.org/copyright.html
/*
**********************************************************************
* Copyright (C) 1997-2015, International Business Machines
// Original plan was to use gcc atomics for MinGW, but they
// aren't supported, so we fold MinGW into this path.
+#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
+#endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE
U_COMMON_API UBool U_EXPORT2 umtx_initImplPreInit(UInitOnce &);
U_COMMON_API void U_EXPORT2 umtx_initImplPostInit(UInitOnce &);
-template<class T> void umtx_initOnce(UInitOnce &uio, T *obj, void (T::*fp)()) {
+template<class T> void umtx_initOnce(UInitOnce &uio, T *obj, void (U_CALLCONV T::*fp)()) {
if (umtx_loadAcquire(uio.fState) == 2) {
return;
}
// umtx_initOnce variant for plain functions, or static class functions.
// No context parameter.
-inline void umtx_initOnce(UInitOnce &uio, void (*fp)()) {
+inline void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)()) {
if (umtx_loadAcquire(uio.fState) == 2) {
return;
}
// umtx_initOnce variant for plain functions, or static class functions.
// With ErrorCode, No context parameter.
-inline void umtx_initOnce(UInitOnce &uio, void (*fp)(UErrorCode &), UErrorCode &errCode) {
+inline void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(UErrorCode &), UErrorCode &errCode) {
if (U_FAILURE(errCode)) {
return;
}
// umtx_initOnce variant for plain functions, or static class functions,
// with a context parameter.
-template<class T> void umtx_initOnce(UInitOnce &uio, void (*fp)(T), T context) {
+template<class T> void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T), T context) {
if (umtx_loadAcquire(uio.fState) == 2) {
return;
}
// umtx_initOnce variant for plain functions, or static class functions,
// with a context parameter and an error code.
-template<class T> void umtx_initOnce(UInitOnce &uio, void (*fp)(T, UErrorCode &), T context, UErrorCode &errCode) {
+template<class T> void umtx_initOnce(UInitOnce &uio, void (U_CALLCONV *fp)(T, UErrorCode &), T context, UErrorCode &errCode) {
if (U_FAILURE(errCode)) {
return;
}
// #inlcude "U_USER_MUTEX_H"
#include U_MUTEX_XSTR(U_USER_MUTEX_H)
-#elif U_PLATFORM_HAS_WIN32_API
-
-/* Windows Definitions.
- * Windows comes first in the platform chain.
- * Cygwin (and possibly others) have both WIN32 and POSIX APIs. Prefer Win32 in this case.
- */
-
+#elif U_PLATFORM_USES_ONLY_WIN32_API
/* For CRITICAL_SECTION */
* win32 APIs for Critical Sections.
*/
+#ifndef WIN32_LEAN_AND_MEAN
# define WIN32_LEAN_AND_MEAN
+#endif
# define VC_EXTRALEAN
# define NOUSER
# define NOSERVICE