threads

threads - interfaces for thread handling

set of generic threading related routines should work with pthreads, Windows native or TLS threads

Author(s): Daniel Veillard

Synopsis

typedef struct _xmlMutex xmlMutex;
typedef xmlMutex * xmlMutexPtr;
typedef struct _xmlRMutex xmlRMutex;
typedef xmlRMutex * xmlRMutexPtr;
int	xmlCheckThreadLocalStorage	(void);
void	xmlCleanupThreads		(void);
void	xmlFreeMutex			(xmlMutexPtr tok);
void	xmlFreeRMutex			(xmlRMutexPtr tok);
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

Details

Structure xmlMutex

struct _xmlMutex {
The content of this structure is not made public by the API.
} xmlMutex;


Typedef xmlMutexPtr

xmlMutex * xmlMutexPtr;


Structure xmlRMutex

struct _xmlRMutex {
The content of this structure is not made public by the API.
} xmlRMutex;


Typedef xmlRMutexPtr

xmlRMutex * xmlRMutexPtr;


xmlCheckThreadLocalStorage ()

int	xmlCheckThreadLocalStorage	(void)

Check whether thread-local storage could be allocated. In cross-platform code running in multithreaded environments, this function should be called once in each thread before calling other library functions to make sure that thread-local storage was allocated properly.

Returns: 0 on success or -1 if a memory allocation failed. A failed allocation signals a typically fatal and irrecoverable out-of-memory situation. Don't call any library functions in this case. This function never fails if the library is compiled with support for thread-local storage. This function never fails for the "main" thread which is the first thread calling xmlInitParser. Available since v2.12.0.

xmlCleanupThreads ()

void	xmlCleanupThreads		(void)

DEPRECATED: This function is a no-op. Call xmlCleanupParser to free global state but see the warnings there. xmlCleanupParser should be only called once at program exit. In most cases, you don't have call cleanup functions at all.


xmlFreeMutex ()

void	xmlFreeMutex			(xmlMutexPtr tok)

Free a mutex.

tok: the simple mutex

xmlFreeRMutex ()

void	xmlFreeRMutex			(xmlRMutexPtr tok)

xmlRFreeMutex() is used to reclaim resources associated with a reentrant mutex.

tok: the reentrant mutex

xmlGetThreadId ()

int	xmlGetThreadId			(void)

DEPRECATED: Internal function, do not use. xmlGetThreadId() find the current thread ID number Note that this is likely to be broken on some platforms using pthreads as the specification doesn't mandate pthread_t to be an integer type

Returns: the current thread ID number

xmlInitThreads ()

void	xmlInitThreads			(void)

DEPRECATED: Alias for xmlInitParser.


xmlIsMainThread ()

int	xmlIsMainThread			(void)

DEPRECATED: Internal function, do not use. Check whether the current thread is the main thread.

Returns: 1 if the current thread is the main thread, 0 otherwise

xmlLockLibrary ()

void	xmlLockLibrary			(void)

xmlLockLibrary() is used to take out a re-entrant lock on the libxml2 library.


xmlMutexLock ()

void	xmlMutexLock			(xmlMutexPtr tok)

xmlMutexLock() is used to lock a libxml2 token.

tok: the simple mutex

xmlMutexUnlock ()

void	xmlMutexUnlock			(xmlMutexPtr tok)

xmlMutexUnlock() is used to unlock a libxml2 token.

tok: the simple mutex

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

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

xmlRMutexLock ()

void	xmlRMutexLock			(xmlRMutexPtr tok)

xmlRMutexLock() is used to lock a libxml2 token_r.

tok: the reentrant mutex

xmlRMutexUnlock ()

void	xmlRMutexUnlock			(xmlRMutexPtr tok)

xmlRMutexUnlock() is used to unlock a libxml2 token_r.

tok: the reentrant mutex

xmlUnlockLibrary ()

void	xmlUnlockLibrary		(void)

xmlUnlockLibrary() is used to release a re-entrant lock on the libxml2 library.