threads.h 1.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384
  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 XMLCALL
  34. xmlNewMutex (void);
  35. XMLPUBFUN void XMLCALL
  36. xmlMutexLock (xmlMutexPtr tok);
  37. XMLPUBFUN void XMLCALL
  38. xmlMutexUnlock (xmlMutexPtr tok);
  39. XMLPUBFUN void XMLCALL
  40. xmlFreeMutex (xmlMutexPtr tok);
  41. XMLPUBFUN xmlRMutexPtr XMLCALL
  42. xmlNewRMutex (void);
  43. XMLPUBFUN void XMLCALL
  44. xmlRMutexLock (xmlRMutexPtr tok);
  45. XMLPUBFUN void XMLCALL
  46. xmlRMutexUnlock (xmlRMutexPtr tok);
  47. XMLPUBFUN void XMLCALL
  48. xmlFreeRMutex (xmlRMutexPtr tok);
  49. /*
  50. * Library wide APIs.
  51. */
  52. XMLPUBFUN void XMLCALL
  53. xmlInitThreads (void);
  54. XMLPUBFUN void XMLCALL
  55. xmlLockLibrary (void);
  56. XMLPUBFUN void XMLCALL
  57. xmlUnlockLibrary(void);
  58. XMLPUBFUN int XMLCALL
  59. xmlGetThreadId (void);
  60. XMLPUBFUN int XMLCALL
  61. xmlIsMainThread (void);
  62. XMLPUBFUN void XMLCALL
  63. xmlCleanupThreads(void);
  64. XMLPUBFUN xmlGlobalStatePtr XMLCALL
  65. xmlGetGlobalState(void);
  66. #if defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && defined(LIBXML_STATIC_FOR_DLL)
  67. int XMLCALL xmlDllMain(void *hinstDLL, unsigned long fdwReason, void *lpvReserved);
  68. #endif
  69. #ifdef __cplusplus
  70. }
  71. #endif
  72. #endif /* __XML_THREADS_H__ */