threads.h 1.9 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889
  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. #ifdef HAVE_PTHREAD_H
  67. #elif defined(HAVE_WIN32_THREADS) && !defined(HAVE_COMPILER_TLS) && (!defined(LIBXML_STATIC) || defined(LIBXML_STATIC_FOR_DLL))
  68. #if defined(LIBXML_STATIC_FOR_DLL)
  69. int XMLCALL
  70. xmlDllMain(void *hinstDLL, unsigned long fdwReason,
  71. void *lpvReserved);
  72. #endif
  73. #endif
  74. #ifdef __cplusplus
  75. }
  76. #endif
  77. #endif /* __XML_THREADS_H__ */