# ## Module threads from libxml2

API Menu
Main Menu Developer Menu Code Examples API Menu Parser API Tree API Reader API XML Guidelines ChangeLog
API Indexes
Alphabetic Constructors Functions/Types Modules Symbols
Related links
Mail archive XSLT libxslt DOM gdome2 XML-DSig xmlsec FTP Windows binaries Solaris binaries MacOsX binaries C++ bindings PHP bindings Pascal bindings Ruby bindings Tcl bindings Bug Tracker
set of generic threading related routines should work with pthreads, Windows native or TLS threads ## Table of Contents
    Structure xmlMutex
    struct _xmlMutex
    The content of this structure is not made public by the API.
    Typedef xmlMutex * xmlMutexPtr
    Structure xmlRMutex
    struct _xmlRMutex
    The content of this structure is not made public by the API.
    Typedef xmlRMutex * xmlRMutexPtr
    void	xmlCleanupThreads		(void)
    void	xmlFreeMutex			(xmlMutexPtr tok)
    void	xmlFreeRMutex			(xmlRMutexPtr tok)
    xmlGlobalStatePtr	xmlGetGlobalState	(void)
    int	xmlGetThreadId			(void)
    void	xmlInitThreads			(void)
    int	xmlIsMainThread			(void)
    void	xmlLockLibrary			(void)
    void	xmlMutexLock			(xmlMutexPtr tok)
    void	xmlMutexUnlock			(xmlMutexPtr tok)
    xmlMutexPtr	xmlNewMutex		(void)
    xmlRMutexPtr	xmlNewRMutex		(void)
    void	xmlRMutexLock			(xmlRMutexPtr tok)
    void	xmlRMutexUnlock			(xmlRMutexPtr tok)
    void	xmlUnlockLibrary		(void)
## Description ### Structure xmlMutex
    Structure xmlMutex
    struct _xmlMutex {
    The content of this structure is not made public by the API.
    }
### Structure xmlRMutex
    Structure xmlRMutex
    struct _xmlRMutex {
    The content of this structure is not made public by the API.
    }
### Function: xmlCleanupThreads
    void	xmlCleanupThreads		(void)
xmlCleanupThreads() is used to to cleanup all the thread related data of the libxml2 library once processing has ended. ### Function: xmlFreeMutex
    void	xmlFreeMutex			(xmlMutexPtr tok)
xmlFreeMutex() is used to reclaim resources associated with a libxml2 token struct.
`tok`: | the simple mutex
### Function: xmlFreeRMutex
    void	xmlFreeRMutex			(xmlRMutexPtr tok)
xmlRFreeMutex() is used to reclaim resources associated with a reentrant mutex.
`tok`: | the reentrant mutex
### Function: xmlGetGlobalState
    xmlGlobalStatePtr	xmlGetGlobalState	(void)
xmlGetGlobalState() is called to retrieve the global state for a thread.
`Returns`: | the thread global state or NULL in case of error
### Function: xmlGetThreadId
    int	xmlGetThreadId			(void)
xmlGetThreadId() find the current thread ID number
`Returns`: | the current thread ID number
### Function: xmlInitThreads
    void	xmlInitThreads			(void)
xmlInitThreads() is used to to initialize all the thread related data of the libxml2 library. ### Function: xmlIsMainThread
    int	xmlIsMainThread			(void)
xmlIsMainThread() check whether the current thread is the main thread.
`Returns`: | 1 if the current thread is the main thread, 0 otherwise
### Function: xmlLockLibrary
    void	xmlLockLibrary			(void)
xmlLockLibrary() is used to take out a re-entrant lock on the libxml2 library. ### Function: xmlMutexLock
    void	xmlMutexLock			(xmlMutexPtr tok)
xmlMutexLock() is used to lock a libxml2 token.
`tok`: | the simple mutex
### Function: xmlMutexUnlock
    void	xmlMutexUnlock			(xmlMutexPtr tok)
xmlMutexUnlock() is used to unlock a libxml2 token.
`tok`: | the simple mutex
### Function: xmlNewMutex
    xmlMutexPtr	xmlNewMutex		(void)
xmlNewMutex() is used to allocate a libxml2 token struct for use in synchronizing access to data.
`Returns`: | a new simple mutex pointer or NULL in case of error
### Function: xmlNewRMutex
    xmlRMutexPtr	xmlNewRMutex		(void)
xmlRNewMutex() is used to allocate a reentrant mutex for use in synchronizing access to data. token_r is a re-entrant lock and thus useful for synchronizing access to data structures that may be manipulated in a recursive fashion.
`Returns`: | the new reentrant mutex pointer or NULL in case of error
### Function: xmlRMutexLock
    void	xmlRMutexLock			(xmlRMutexPtr tok)
xmlRMutexLock() is used to lock a libxml2 token_r.
`tok`: | the reentrant mutex
### Function: xmlRMutexUnlock
    void	xmlRMutexUnlock			(xmlRMutexPtr tok)
xmlRMutexUnlock() is used to unlock a libxml2 token_r.
`tok`: | the reentrant mutex
### Function: xmlUnlockLibrary
    void	xmlUnlockLibrary		(void)
xmlUnlockLibrary() is used to release a re-entrant lock on the libxml2 library. Daniel Veillard