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

Function GWKThreadsCreate

alg/gdalwarpkernel.cpp:309–332  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

307/************************************************************************/
308
309void *GWKThreadsCreate(char **papszWarpOptions,
310 GDALTransformerFunc /* pfnTransformer */,
311 void *pTransformerArg)
312{
313 const int nThreads = GDALGetNumThreads(papszWarpOptions, "NUM_THREADS",
314 GDAL_DEFAULT_MAX_THREAD_COUNT,
315 /* bDefaultAllCPUs = */ false);
316 GWKThreadData *psThreadData = new GWKThreadData();
317 auto poThreadPool =
318 nThreads > 1 ? GDALGetGlobalThreadPool(nThreads) : nullptr;
319 if (poThreadPool)
320 {
321 psThreadData->nMaxThreads = nThreads;
322 psThreadData->threadJobs.reset(new std::vector<GWKJobStruct>(
323 nThreads,
324 GWKJobStruct(psThreadData->mutex, psThreadData->cv,
325 psThreadData->counter, psThreadData->stopFlag)));
326
327 psThreadData->poJobQueue = poThreadPool->CreateJobQueue();
328 psThreadData->pTransformerArgInput = pTransformerArg;
329 }
330
331 return psThreadData;
332}
333
334/************************************************************************/
335/* GWKThreadsEnd() */

Callers 1

InitializeMethod · 0.85

Calls 5

GDALGetNumThreadsFunction · 0.85
GDALGetGlobalThreadPoolFunction · 0.85
GWKJobStructClass · 0.85
CreateJobQueueMethod · 0.80
resetMethod · 0.45

Tested by

no test coverage detected