threads.h 1.8 KB

12345678910111213141516171819202122232425262728293031323334353637383940414243444546474849505152535455565758596061626364656667686970717273747576777879808182838485868788899091929394
  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. #ifndef __XML_THREADS_H__
  11. #define __XML_THREADS_H__
  12. #include <libxml/xmlversion.h>
  13. #ifdef __cplusplus
  14. extern "C" {
  15. #endif
  16. /*
  17. * xmlMutex are a simple mutual exception locks.
  18. */
  19. typedef struct _xmlMutex xmlMutex;
  20. typedef xmlMutex *xmlMutexPtr;
  21. /*
  22. * xmlRMutex are reentrant mutual exception locks.
  23. */
  24. typedef struct _xmlRMutex xmlRMutex;
  25. typedef xmlRMutex *xmlRMutexPtr;
  26. #ifdef __cplusplus
  27. }
  28. #endif
  29. #include <libxml/globals.h>
  30. #ifdef __cplusplus
  31. extern "C" {
  32. #endif
  33. XMLPUBFUN xmlMutexPtr
  34. xmlNewMutex (void);
  35. XMLPUBFUN void
  36. xmlMutexLock (xmlMutexPtr tok);
  37. XMLPUBFUN void
  38. xmlMutexUnlock (xmlMutexPtr tok);
  39. XMLPUBFUN void
  40. xmlFreeMutex (xmlMutexPtr tok);
  41. XMLPUBFUN xmlRMutexPtr
  42. xmlNewRMutex (void);
  43. XMLPUBFUN void
  44. xmlRMutexLock (xmlRMutexPtr tok);
  45. XMLPUBFUN void
  46. xmlRMutexUnlock (xmlRMutexPtr tok);
  47. XMLPUBFUN void
  48. xmlFreeRMutex (xmlRMutexPtr tok);
  49. /*
  50. * Library wide APIs.
  51. */
  52. XML_DEPRECATED
  53. XMLPUBFUN void
  54. xmlInitThreads (void);
  55. XMLPUBFUN void
  56. xmlLockLibrary (void);
  57. XMLPUBFUN void
  58. xmlUnlockLibrary(void);
  59. XML_DEPRECATED
  60. XMLPUBFUN int
  61. xmlGetThreadId (void);
  62. XML_DEPRECATED
  63. XMLPUBFUN int
  64. xmlIsMainThread (void);
  65. XML_DEPRECATED
  66. XMLPUBFUN void
  67. xmlCleanupThreads(void);
  68. XML_DEPRECATED
  69. XMLPUBFUN xmlGlobalStatePtr
  70. xmlGetGlobalState(void);
  71. /** DOC_DISABLE */
  72. #if defined(LIBXML_THREAD_ENABLED) && defined(_WIN32) && \
  73. !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
  74. int
  75. xmlDllMain(void *hinstDLL, unsigned long fdwReason,
  76. void *lpvReserved);
  77. #endif
  78. /** DOC_ENABLE */
  79. #ifdef __cplusplus
  80. }
  81. #endif
  82. #endif /* __XML_THREADS_H__ */