diff options
author | orivej <orivej@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
---|---|---|
committer | Daniil Cherednik <dcherednik@yandex-team.ru> | 2022-02-10 16:44:49 +0300 |
commit | 718c552901d703c502ccbefdfc3c9028d608b947 (patch) | |
tree | 46534a98bbefcd7b1f3faa5b52c138ab27db75b7 /contrib/libs/libxml/threads.c | |
parent | e9656aae26e0358d5378e5b63dcac5c8dbe0e4d0 (diff) | |
download | ydb-718c552901d703c502ccbefdfc3c9028d608b947.tar.gz |
Restoring authorship annotation for <orivej@yandex-team.ru>. Commit 1 of 2.
Diffstat (limited to 'contrib/libs/libxml/threads.c')
-rw-r--r-- | contrib/libs/libxml/threads.c | 130 |
1 files changed, 65 insertions, 65 deletions
diff --git a/contrib/libs/libxml/threads.c b/contrib/libs/libxml/threads.c index 72df9ba997..1f92940618 100644 --- a/contrib/libs/libxml/threads.c +++ b/contrib/libs/libxml/threads.c @@ -27,7 +27,7 @@ #ifdef HAVE_PTHREAD_H #include <pthread.h> #elif defined HAVE_WIN32_THREADS -#define WIN32_LEAN_AND_MEAN +#define WIN32_LEAN_AND_MEAN #include <windows.h> #ifndef HAVE_COMPILER_TLS #include <process.h> @@ -47,42 +47,42 @@ #ifdef HAVE_PTHREAD_H -#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \ - defined(__GLIBC__) && defined(__linux__) - +#if defined(__GNUC__) && (__GNUC__ * 100 + __GNUC_MINOR__ >= 303) && \ + defined(__GLIBC__) && defined(__linux__) + static int libxml_is_threaded = -1; - -#define XML_PTHREAD_WEAK - -#pragma weak pthread_once -#pragma weak pthread_getspecific -#pragma weak pthread_setspecific -#pragma weak pthread_key_create -#pragma weak pthread_key_delete -#pragma weak pthread_mutex_init -#pragma weak pthread_mutex_destroy -#pragma weak pthread_mutex_lock -#pragma weak pthread_mutex_unlock -#pragma weak pthread_cond_init -#pragma weak pthread_cond_destroy -#pragma weak pthread_cond_wait -#pragma weak pthread_equal -#pragma weak pthread_self -#pragma weak pthread_key_create -#pragma weak pthread_key_delete -#pragma weak pthread_cond_signal - -#else /* __GNUC__, __GLIBC__, __linux__ */ - -static int libxml_is_threaded = 1; - -#endif /* __GNUC__, __GLIBC__, __linux__ */ - + +#define XML_PTHREAD_WEAK + +#pragma weak pthread_once +#pragma weak pthread_getspecific +#pragma weak pthread_setspecific +#pragma weak pthread_key_create +#pragma weak pthread_key_delete +#pragma weak pthread_mutex_init +#pragma weak pthread_mutex_destroy +#pragma weak pthread_mutex_lock +#pragma weak pthread_mutex_unlock +#pragma weak pthread_cond_init +#pragma weak pthread_cond_destroy +#pragma weak pthread_cond_wait +#pragma weak pthread_equal +#pragma weak pthread_self +#pragma weak pthread_key_create +#pragma weak pthread_key_delete +#pragma weak pthread_cond_signal + +#else /* __GNUC__, __GLIBC__, __linux__ */ + +static int libxml_is_threaded = 1; + +#endif /* __GNUC__, __GLIBC__, __linux__ */ + #endif /* HAVE_PTHREAD_H */ /* * TODO: this module still uses malloc/free and not xmlMalloc/xmlFree - * to avoid some craziness since xmlMalloc/xmlFree may actually + * to avoid some craziness since xmlMalloc/xmlFree may actually * be hosted on allocated blocks needing them for the allocation ... */ @@ -146,7 +146,7 @@ static DWORD globalkey = TLS_OUT_OF_INDEXES; static DWORD mainthread; static struct { DWORD done; - LONG control; + LONG control; } run_once = { 0, 0}; static volatile LPCRITICAL_SECTION global_init_lock = NULL; @@ -239,7 +239,7 @@ xmlMutexLock(xmlMutexPtr tok) if (acquire_sem(tok->sem) != B_NO_ERROR) { #ifdef DEBUG_THREADS xmlGenericError(xmlGenericErrorContext, - "xmlMutexLock():BeOS:Couldn't acquire semaphore\n"); + "xmlMutexLock():BeOS:Couldn't acquire semaphore\n"); #endif } tok->tid = find_thread(NULL); @@ -403,7 +403,7 @@ xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED) pthread_mutex_unlock(&tok->lock); #elif defined HAVE_WIN32_THREADS if (tok->count > 0) { - tok->count--; + tok->count--; LeaveCriticalSection(&tok->cs); } #elif defined HAVE_BEOS_THREADS @@ -429,11 +429,11 @@ __xmlGlobalInitMutexLock(void) /* Make sure the global init lock is initialized and then lock it. */ #ifdef HAVE_PTHREAD_H /* The mutex is statically initialized, so we just lock it. */ -#ifdef XML_PTHREAD_WEAK - if (pthread_mutex_lock == NULL) - return; -#endif /* XML_PTHREAD_WEAK */ - pthread_mutex_lock(&global_init_lock); +#ifdef XML_PTHREAD_WEAK + if (pthread_mutex_lock == NULL) + return; +#endif /* XML_PTHREAD_WEAK */ + pthread_mutex_lock(&global_init_lock); #elif defined HAVE_WIN32_THREADS LPCRITICAL_SECTION cs; @@ -449,8 +449,8 @@ __xmlGlobalInitMutexLock(void) /* Swap it into the global_init_lock */ #ifdef InterlockedCompareExchangePointer - InterlockedCompareExchangePointer((void **) &global_init_lock, - cs, NULL); + InterlockedCompareExchangePointer((void **) &global_init_lock, + cs, NULL); #else /* Use older void* version */ InterlockedCompareExchange((void **) &global_init_lock, (void *) cs, NULL); @@ -502,11 +502,11 @@ void __xmlGlobalInitMutexUnlock(void) { #ifdef HAVE_PTHREAD_H -#ifdef XML_PTHREAD_WEAK - if (pthread_mutex_unlock == NULL) - return; -#endif /* XML_PTHREAD_WEAK */ - pthread_mutex_unlock(&global_init_lock); +#ifdef XML_PTHREAD_WEAK + if (pthread_mutex_unlock == NULL) + return; +#endif /* XML_PTHREAD_WEAK */ + pthread_mutex_unlock(&global_init_lock); #elif defined HAVE_WIN32_THREADS if (global_init_lock != NULL) { LeaveCriticalSection(global_init_lock); @@ -858,7 +858,7 @@ void xmlInitThreads(void) { #ifdef HAVE_PTHREAD_H -#ifdef XML_PTHREAD_WEAK +#ifdef XML_PTHREAD_WEAK if (libxml_is_threaded == -1) { if ((pthread_once != NULL) && (pthread_getspecific != NULL) && @@ -884,7 +884,7 @@ xmlInitThreads(void) libxml_is_threaded = 0; } } -#endif /* XML_PTHREAD_WEAK */ +#endif /* XML_PTHREAD_WEAK */ #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) InitializeCriticalSection(&cleanup_helpers_cs); #endif @@ -911,7 +911,7 @@ xmlCleanupThreads(void) xmlGenericError(xmlGenericErrorContext, "xmlCleanupThreads()\n"); #endif #ifdef HAVE_PTHREAD_H - if (libxml_is_threaded != 0) + if (libxml_is_threaded != 0) pthread_key_delete(globalkey); once_control = once_control_init; #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) @@ -996,23 +996,23 @@ xmlOnceInit(void) #ifdef HAVE_PTHREAD_H #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) #if defined(LIBXML_STATIC_FOR_DLL) -int XMLCALL -xmlDllMain(ATTRIBUTE_UNUSED void *hinstDLL, unsigned long fdwReason, - ATTRIBUTE_UNUSED void *lpvReserved) +int XMLCALL +xmlDllMain(ATTRIBUTE_UNUSED void *hinstDLL, unsigned long fdwReason, + ATTRIBUTE_UNUSED void *lpvReserved) #else -/* declare to avoid "no previous prototype for 'DllMain'" warning */ -/* Note that we do NOT want to include this function declaration in - a public header because it's meant to be called by Windows itself, - not a program that uses this library. This also has to be exported. */ - -XMLPUBFUN BOOL WINAPI -DllMain (HINSTANCE hinstDLL, - DWORD fdwReason, - LPVOID lpvReserved); - +/* declare to avoid "no previous prototype for 'DllMain'" warning */ +/* Note that we do NOT want to include this function declaration in + a public header because it's meant to be called by Windows itself, + not a program that uses this library. This also has to be exported. */ + +XMLPUBFUN BOOL WINAPI +DllMain (HINSTANCE hinstDLL, + DWORD fdwReason, + LPVOID lpvReserved); + BOOL WINAPI -DllMain(ATTRIBUTE_UNUSED HINSTANCE hinstDLL, DWORD fdwReason, - ATTRIBUTE_UNUSED LPVOID lpvReserved) +DllMain(ATTRIBUTE_UNUSED HINSTANCE hinstDLL, DWORD fdwReason, + ATTRIBUTE_UNUSED LPVOID lpvReserved) #endif { switch (fdwReason) { |