* xmlRMutexUnlock: * @tok: the reentrant mutex * * xmlRMutexUnlock() is used to unlock a libxml2 token_r. */
| 331 | * xmlRMutexUnlock() is used to unlock a libxml2 token_r. |
| 332 | */ |
| 333 | void |
| 334 | xmlRMutexUnlock(xmlRMutexPtr tok ATTRIBUTE_UNUSED) |
| 335 | { |
| 336 | if (tok == NULL) |
| 337 | return; |
| 338 | #ifdef HAVE_POSIX_THREADS |
| 339 | if (XML_IS_THREADED() == 0) |
| 340 | return; |
| 341 | |
| 342 | pthread_mutex_lock(&tok->lock); |
| 343 | tok->held--; |
| 344 | if (tok->held == 0) { |
| 345 | if (tok->waiters) |
| 346 | pthread_cond_signal(&tok->cv); |
| 347 | memset(&tok->tid, 0, sizeof(tok->tid)); |
| 348 | } |
| 349 | pthread_mutex_unlock(&tok->lock); |
| 350 | #elif defined HAVE_WIN32_THREADS |
| 351 | LeaveCriticalSection(&tok->cs); |
| 352 | #endif |
| 353 | } |
| 354 | |
| 355 | /************************************************************************ |
| 356 | * * |
no outgoing calls
no test coverage detected