* xmlMutexLock: * @tok: the simple mutex * * xmlMutexLock() is used to lock a libxml2 token. */
| 199 | * xmlMutexLock() is used to lock a libxml2 token. |
| 200 | */ |
| 201 | void |
| 202 | xmlMutexLock(xmlMutexPtr tok) |
| 203 | { |
| 204 | if (tok == NULL) |
| 205 | return; |
| 206 | #ifdef HAVE_POSIX_THREADS |
| 207 | /* |
| 208 | * This assumes that __libc_single_threaded won't change while the |
| 209 | * lock is held. |
| 210 | */ |
| 211 | if (XML_IS_THREADED() != 0) |
| 212 | pthread_mutex_lock(&tok->lock); |
| 213 | #elif defined HAVE_WIN32_THREADS |
| 214 | EnterCriticalSection(&tok->cs); |
| 215 | #endif |
| 216 | |
| 217 | } |
| 218 | |
| 219 | /** |
| 220 | * xmlMutexUnlock: |
no outgoing calls
no test coverage detected