libxml2: threads.h File Reference

libxml2

Loading...
Searching...
No Matches
Typedefs | Functions
threads.h File Reference

interfaces for thread handling More...

## Typedefs
typedef struct _xmlMutex | xmlMutex
| Mutual exclusion object.
typedef struct _xmlRMutex | xmlRMutex
| Reentrant mutual exclusion object.

## Functions
int | xmlCheckThreadLocalStorage (void)
| Check whether thread-local storage could be allocated.
xmlMutex * | xmlNewMutex (void)
| xmlNewMutex is used to allocate a libxml2 token struct for use in synchronizing access to data.
void | xmlMutexLock (xmlMutex *tok)
| xmlMutexLock is used to lock a libxml2 token.
void | xmlMutexUnlock (xmlMutex *tok)
| xmlMutexUnlock is used to unlock a libxml2 token.
void | xmlFreeMutex (xmlMutex *tok)
| Free a mutex.
xmlRMutex * | xmlNewRMutex (void)
| Used to allocate a reentrant mutex for use in synchronizing access to data.
void | xmlRMutexLock (xmlRMutex *tok)
| xmlRMutexLock is used to lock a libxml2 token_r.
void | xmlRMutexUnlock (xmlRMutex *tok)
| xmlRMutexUnlock is used to unlock a libxml2 token_r.
void | xmlFreeRMutex (xmlRMutex *tok)
| Used to reclaim resources associated with a reentrant mutex.
void | xmlInitThreads (void)
void | xmlLockLibrary (void)
| xmlLockLibrary is used to take out a re-entrant lock on the libxml2 library.
void | xmlUnlockLibrary (void)
| xmlUnlockLibrary is used to release a re-entrant lock on the libxml2 library.
void | xmlCleanupThreads (void)

## Detailed Description

interfaces for thread handling

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

Copyright
  See Copyright for the status of this software.

Author
  Daniel Veillard

## Function Documentation

## ◆ 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.

Since
  2.12.0

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.

## ◆ 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 | ( | xmlMutex * | tok | ) |

Free a mutex.

Parameters

  tok | the simple mutex

## ◆ xmlFreeRMutex()

void xmlFreeRMutex | ( | xmlRMutex * | tok | ) |

Used to reclaim resources associated with a reentrant mutex.

Parameters

  tok | the reentrant mutex

## ◆ xmlInitThreads()

void xmlInitThreads | ( | void |  | ) |

Deprecated
  Alias for xmlInitParser.

## ◆ xmlMutexLock()

void xmlMutexLock | ( | xmlMutex * | tok | ) |

xmlMutexLock is used to lock a libxml2 token.

Parameters

  tok | the simple mutex

## ◆ xmlMutexUnlock()

void xmlMutexUnlock | ( | xmlMutex * | tok | ) |

xmlMutexUnlock is used to unlock a libxml2 token.

Parameters

  tok | the simple mutex

## ◆ xmlNewMutex()

xmlMutex * 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()

xmlRMutex * xmlNewRMutex | ( | void |  | ) |

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 | ( | xmlRMutex * | tok | ) |

xmlRMutexLock is used to lock a libxml2 token_r.

Parameters

  tok | the reentrant mutex

## ◆ xmlRMutexUnlock()

void xmlRMutexUnlock | ( | xmlRMutex * | tok | ) |

xmlRMutexUnlock is used to unlock a libxml2 token_r.

Parameters

  tok | the reentrant mutex