X-Git-Url: http://www.project-moonshot.org/gitweb/?a=blobdiff_plain;f=mech_eap%2Futil_attr.cpp;h=d3c99d311963d3d167974ab3e83410861beeea58;hb=9aab3038cc41b5f621d545df8302fdd7f957aa49;hp=3bfe7856df73de60c8bde0c2257ac3558b512698;hpb=61a89c5caecb797c32dcbe712313dfd0ebcc5558;p=mech_eap.git diff --git a/mech_eap/util_attr.cpp b/mech_eap/util_attr.cpp index 3bfe785..d3c99d3 100644 --- a/mech_eap/util_attr.cpp +++ b/mech_eap/util_attr.cpp @@ -43,8 +43,12 @@ #include /* lazy initialisation */ +#ifdef WIN32 +static volatile OM_uint32 gssEapAttrProvidersInitStatus = GSS_S_UNAVAILABLE; +#else static GSSEAP_THREAD_ONCE gssEapAttrProvidersInitOnce = GSSEAP_ONCE_INITIALIZER; static OM_uint32 gssEapAttrProvidersInitStatus = GSS_S_UNAVAILABLE; +#endif GSSEAP_ONCE_CALLBACK(gssEapAttrProvidersInitInternal) { @@ -74,7 +78,12 @@ cleanup: GSSEAP_ASSERT(major == GSS_S_COMPLETE); #endif +#ifdef WIN32 + InterlockedCompareExchangeRelease(&gssEapAttrProvidersInitStatus, + major, GSS_S_UNAVAILABLE); +#else gssEapAttrProvidersInitStatus = major; +#endif GSSEAP_ONCE_LEAVE; } @@ -82,7 +91,12 @@ cleanup: static OM_uint32 gssEapAttrProvidersInit(OM_uint32 *minor) { +#ifdef WIN32 + if (gssEapAttrProvidersInitStatus == GSS_S_UNAVAILABLE) + gssEapAttrProvidersInitInternal(); +#else GSSEAP_ONCE(&gssEapAttrProvidersInitOnce, gssEapAttrProvidersInitInternal); +#endif if (GSS_ERROR(gssEapAttrProvidersInitStatus)) *minor = GSSEAP_NO_ATTR_PROVIDERS;