| 1 |
#ifndef XML_THREADS_H_PRIVATE__ |
| 2 |
#define XML_THREADS_H_PRIVATE__ |
| 3 |
|
| 4 |
#include <libxml/threads.h> |
| 5 |
|
| 6 |
#ifdef LIBXML_THREAD_ENABLED |
| 7 |
#ifdef _WIN32 |
| 8 |
#define WIN32_LEAN_AND_MEAN |
| 9 |
#ifdef _WIN32_WINNT |
| 10 |
#if _WIN32_WINNT < 0x0600 |
| 11 |
#undef _WIN32_WINNT |
| 12 |
#endif |
| 13 |
#else |
| 14 |
/* get the default version of the SDK */ |
| 15 |
#include <sdkddkver.h> |
| 16 |
#endif |
| 17 |
#ifndef _WIN32_WINNT |
| 18 |
#define _WIN32_WINNT 0x0600 |
| 19 |
#endif |
| 20 |
#include <windows.h> |
| 21 |
#define HAVE_WIN32_THREADS |
| 22 |
#else |
| 23 |
#include <pthread.h> |
| 24 |
#define HAVE_POSIX_THREADS |
| 25 |
#endif |
| 26 |
#endif |
| 27 |
|
| 28 |
/* |
| 29 |
* xmlMutex are a simple mutual exception locks |
| 30 |
*/ |
| 31 |
struct _xmlMutex { |
| 32 |
#ifdef HAVE_POSIX_THREADS |
| 33 |
pthread_mutex_t lock; |
| 34 |
#elif defined HAVE_WIN32_THREADS |
| 35 |
CRITICAL_SECTION cs; |
| 36 |
#else |
| 37 |
int empty; |
| 38 |
#endif |
| 39 |
}; |
| 40 |
|
| 41 |
/* |
| 42 |
* xmlRMutex are reentrant mutual exception locks |
| 43 |
*/ |
| 44 |
struct _xmlRMutex { |
| 45 |
#ifdef HAVE_POSIX_THREADS |
| 46 |
pthread_mutex_t lock; |
| 47 |
unsigned int held; |
| 48 |
unsigned int waiters; |
| 49 |
pthread_t tid; |
| 50 |
pthread_cond_t cv; |
| 51 |
#elif defined HAVE_WIN32_THREADS |
| 52 |
CRITICAL_SECTION cs; |
| 53 |
#else |
| 54 |
int empty; |
| 55 |
#endif |
| 56 |
}; |
| 57 |
|
| 58 |
XML_HIDDEN void |
| 59 |
xmlInitMutex(xmlMutex *mutex); |
| 60 |
XML_HIDDEN void |
| 61 |
xmlCleanupMutex(xmlMutex *mutex); |
| 62 |
|
| 63 |
XML_HIDDEN void |
| 64 |
xmlInitRMutex(xmlRMutex *mutex); |
| 65 |
XML_HIDDEN void |
| 66 |
xmlCleanupRMutex(xmlRMutex *mutex); |
| 67 |
|
| 68 |
#ifdef LIBXML_SCHEMAS_ENABLED |
| 69 |
XML_HIDDEN void |
| 70 |
xmlInitSchemasTypesInternal(void); |
| 71 |
XML_HIDDEN void |
| 72 |
xmlCleanupSchemasTypesInternal(void); |
| 73 |
#endif |
| 74 |
|
| 75 |
#ifdef LIBXML_RELAXNG_ENABLED |
| 76 |
XML_HIDDEN void |
| 77 |
xmlInitRelaxNGInternal(void); |
| 78 |
XML_HIDDEN void |
| 79 |
xmlCleanupRelaxNGInternal(void); |
| 80 |
#endif |
| 81 |
|
| 82 |
|
| 83 |
#endif /* XML_THREADS_H_PRIVATE__ */ |