1 /* libxml2 - Library for parsing XML documents 2 * Copyright (C) 2006-2019 Free Software Foundation, Inc. 3 * 4 * This file is not part of the GNU gettext program, but is used with 5 * GNU gettext. 6 * 7 * The original copyright notice is as follows: 8 */ 9 10 /* 11 * Copyright (C) 1998-2012 Daniel Veillard. All Rights Reserved. 12 * 13 * Permission is hereby granted, free of charge, to any person obtaining a copy 14 * of this software and associated documentation files (the "Software"), to deal 15 * in the Software without restriction, including without limitation the rights 16 * to use, copy, modify, merge, publish, distribute, sublicense, and/or sell 17 * copies of the Software, and to permit persons to whom the Software is fur- 18 * nished to do so, subject to the following conditions: 19 * 20 * The above copyright notice and this permission notice shall be included in 21 * all copies or substantial portions of the Software. 22 * 23 * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR 24 * IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FIT- 25 * NESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE 26 * AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER 27 * LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, 28 * OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN 29 * THE SOFTWARE. 30 * 31 * Author: Daniel Veillard 32 */ 33 34 /** 35 * Summary: interfaces for thread handling 36 * Description: set of generic threading related routines 37 * should work with pthreads, Windows native or TLS threads 38 */ 39 40 #ifndef __XML_THREADS_H__ 41 #define __XML_THREADS_H__ 42 43 #include <libxml/xmlversion.h> 44 45 #ifdef __cplusplus 46 extern "C" { 47 #endif 48 49 /* 50 * xmlMutex are a simple mutual exception locks. 51 */ 52 typedef struct _xmlMutex xmlMutex; 53 typedef xmlMutex *xmlMutexPtr; 54 55 /* 56 * xmlRMutex are reentrant mutual exception locks. 57 */ 58 typedef struct _xmlRMutex xmlRMutex; 59 typedef xmlRMutex *xmlRMutexPtr; 60 61 #ifdef __cplusplus 62 } 63 #endif 64 #include <libxml/globals.h> 65 #ifdef __cplusplus 66 extern "C" { 67 #endif 68 XMLPUBFUN xmlMutexPtr XMLCALL 69 xmlNewMutex (void); 70 XMLPUBFUN void XMLCALL 71 xmlMutexLock (xmlMutexPtr tok); 72 XMLPUBFUN void XMLCALL 73 xmlMutexUnlock (xmlMutexPtr tok); 74 XMLPUBFUN void XMLCALL 75 xmlFreeMutex (xmlMutexPtr tok); 76 77 XMLPUBFUN xmlRMutexPtr XMLCALL 78 xmlNewRMutex (void); 79 XMLPUBFUN void XMLCALL 80 xmlRMutexLock (xmlRMutexPtr tok); 81 XMLPUBFUN void XMLCALL 82 xmlRMutexUnlock (xmlRMutexPtr tok); 83 XMLPUBFUN void XMLCALL 84 xmlFreeRMutex (xmlRMutexPtr tok); 85 86 /* 87 * Library wide APIs. 88 */ 89 XMLPUBFUN void XMLCALL 90 xmlInitThreads (void); 91 XMLPUBFUN void XMLCALL 92 xmlLockLibrary (void); 93 XMLPUBFUN void XMLCALL 94 xmlUnlockLibrary(void); 95 XMLPUBFUN int XMLCALL 96 xmlGetThreadId (void); 97 XMLPUBFUN int XMLCALL 98 xmlIsMainThread (void); 99 XMLPUBFUN void XMLCALL 100 xmlCleanupThreads(void); 101 XMLPUBFUN xmlGlobalStatePtr XMLCALL 102 xmlGetGlobalState(void); 103 104 #ifdef HAVE_PTHREAD_H 105 #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL)) 106 #if defined(LIBXML_STATIC_FOR_DLL) 107 int XMLCALL 108 xmlDllMain(void *hinstDLL, unsigned long fdwReason, 109 void *lpvReserved); 110 #endif 111 #endif 112 113 #ifdef __cplusplus 114 } 115 #endif 116 117 118 #endif /* __XML_THREADS_H__ */ 119