MCPcopy Create free account
hub / github.com/Kitware/VTK / xmlRMutexLock

Function xmlRMutexLock

ThirdParty/libxml2/vtklibxml2/threads.c:297–325  ·  view source on GitHub ↗

* xmlRMutexLock: * @tok: the reentrant mutex * * xmlRMutexLock() is used to lock a libxml2 token_r. */

Source from the content-addressed store, hash-verified

295 * xmlRMutexLock() is used to lock a libxml2 token_r.
296 */
297void
298xmlRMutexLock(xmlRMutexPtr tok)
299{
300 if (tok == NULL)
301 return;
302#ifdef HAVE_POSIX_THREADS
303 if (XML_IS_THREADED() == 0)
304 return;
305
306 pthread_mutex_lock(&tok->lock);
307 if (tok->held) {
308 if (pthread_equal(tok->tid, pthread_self())) {
309 tok->held++;
310 pthread_mutex_unlock(&tok->lock);
311 return;
312 } else {
313 tok->waiters++;
314 while (tok->held)
315 pthread_cond_wait(&tok->cv, &tok->lock);
316 tok->waiters--;
317 }
318 }
319 tok->tid = pthread_self();
320 tok->held = 1;
321 pthread_mutex_unlock(&tok->lock);
322#elif defined HAVE_WIN32_THREADS
323 EnterCriticalSection(&tok->cs);
324#endif
325}
326
327/**
328 * xmlRMutexUnlock:

Callers 8

xmlFetchXMLCatalogFileFunction · 0.85
xmlInitializeCatalogFunction · 0.85
xmlLoadCatalogFunction · 0.85
xmlCatalogCleanupFunction · 0.85
xmlCatalogAddFunction · 0.85
xmlCatalogRemoveFunction · 0.85
xmlCatalogConvertFunction · 0.85
xmlLockLibraryFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected