| 307 | /************************************************************************/ |
| 308 | |
| 309 | void *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() */ |
no test coverage detected