MCPcopy Create free account
hub / github.com/OSGeo/gdal / CPLVirtualMemDeclareThread

Function CPLVirtualMemDeclareThread

port/cpl_virtualmem.cpp:536–551  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

534/************************************************************************/
535
536void CPLVirtualMemDeclareThread(CPLVirtualMem *ctxt)
537{
538 if (ctxt->eType == VIRTUAL_MEM_TYPE_FILE_MEMORY_MAPPED)
539 return;
540#ifndef HAVE_5ARGS_MREMAP
541 CPLVirtualMemVMA *ctxtVMA = reinterpret_cast<CPLVirtualMemVMA *>(ctxt);
542 IGNORE_OR_ASSERT_IN_DEBUG(!ctxt->bSingleThreadUsage);
543 CPLAcquireMutex(ctxtVMA->hMutexThreadArray, 1000.0);
544 ctxtVMA->pahThreads = static_cast<pthread_t *>(CPLRealloc(
545 ctxtVMA->pahThreads, (ctxtVMA->nThreads + 1) * sizeof(pthread_t)));
546 ctxtVMA->pahThreads[ctxtVMA->nThreads] = pthread_self();
547 ctxtVMA->nThreads++;
548
549 CPLReleaseMutex(ctxtVMA->hMutexThreadArray);
550#endif
551}
552
553/************************************************************************/
554/* CPLVirtualMemUnDeclareThread() */

Callers 2

test_two_pages_threadFunction · 0.85
test_two_pagesFunction · 0.85

Calls 3

CPLAcquireMutexFunction · 0.85
CPLReallocFunction · 0.85
CPLReleaseMutexFunction · 0.85

Tested by 2

test_two_pages_threadFunction · 0.68
test_two_pagesFunction · 0.68