• Home
  • Line#
  • Scopes#
  • Navigate#
  • Raw
  • Download
1 /**
2  * Summary: interfaces for thread handling
3  * Description: set of generic threading related routines
4  *              should work with pthreads, Windows native or TLS threads
5  *
6  * Copy: See Copyright for the status of this software.
7  *
8  * Author: Daniel Veillard
9  */
10 
11 #ifndef __XML_THREADS_H__
12 #define __XML_THREADS_H__
13 
14 #include <libxml/xmlversion.h>
15 
16 #ifdef __cplusplus
17 extern "C" {
18 #endif
19 
20 /*
21  * xmlMutex are a simple mutual exception locks.
22  */
23 typedef struct _xmlMutex xmlMutex;
24 typedef xmlMutex *xmlMutexPtr;
25 
26 /*
27  * xmlRMutex are reentrant mutual exception locks.
28  */
29 typedef struct _xmlRMutex xmlRMutex;
30 typedef xmlRMutex *xmlRMutexPtr;
31 
32 #ifdef __cplusplus
33 }
34 #endif
35 #include <libxml/globals.h>
36 #ifdef __cplusplus
37 extern "C" {
38 #endif
39 XMLPUBFUN xmlMutexPtr
40 			xmlNewMutex	(void);
41 XMLPUBFUN void
42 			xmlMutexLock	(xmlMutexPtr tok);
43 XMLPUBFUN void
44 			xmlMutexUnlock	(xmlMutexPtr tok);
45 XMLPUBFUN void
46 			xmlFreeMutex	(xmlMutexPtr tok);
47 
48 XMLPUBFUN xmlRMutexPtr
49 			xmlNewRMutex	(void);
50 XMLPUBFUN void
51 			xmlRMutexLock	(xmlRMutexPtr tok);
52 XMLPUBFUN void
53 			xmlRMutexUnlock	(xmlRMutexPtr tok);
54 XMLPUBFUN void
55 			xmlFreeRMutex	(xmlRMutexPtr tok);
56 
57 /*
58  * Library wide APIs.
59  */
60 XML_DEPRECATED
61 XMLPUBFUN void
62 			xmlInitThreads	(void);
63 XMLPUBFUN void
64 			xmlLockLibrary	(void);
65 XMLPUBFUN void
66 			xmlUnlockLibrary(void);
67 XML_DEPRECATED
68 XMLPUBFUN int
69 			xmlGetThreadId	(void);
70 XML_DEPRECATED
71 XMLPUBFUN int
72 			xmlIsMainThread	(void);
73 XML_DEPRECATED
74 XMLPUBFUN void
75 			xmlCleanupThreads(void);
76 XML_DEPRECATED
77 XMLPUBFUN xmlGlobalStatePtr
78 			xmlGetGlobalState(void);
79 
80 /** DOC_DISABLE */
81 #if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
82     !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
83 int
84 xmlDllMain(void *hinstDLL, unsigned long fdwReason,
85            void *lpvReserved);
86 #endif
87 /** DOC_ENABLE */
88 
89 #ifdef __cplusplus
90 }
91 #endif
92 
93 
94 #endif /* __XML_THREADS_H__ */
95