20d2f29ca6491f11c70c95e041220fe72c37a2dd galt Sun Dec 22 15:06:45 2024 -0800 fix compiler warning about about restrict keywords in pthread_create. diff --git src/hg/lib/customFactory.c src/hg/lib/customFactory.c index b9ade75..33240cc 100644 --- src/hg/lib/customFactory.c +++ src/hg/lib/customFactory.c @@ -4053,38 +4053,34 @@ return setting; return trackDbSetting(ct->tdb, "genome"); } struct paraFetchData { struct paraFetchData *next; struct customTrack *track; struct customFactory *fac; boolean done; }; static pthread_mutex_t pfdMutex = PTHREAD_MUTEX_INITIALIZER; static struct paraFetchData *pfdList = NULL, *pfdRunning = NULL, *pfdDone = NULL, *pfdNeverStarted = NULL; -static void *remoteParallelLoad(void *threadParam) +static void *remoteParallelLoad() /* Each thread loads tracks in parallel until all work is done. */ { -pthread_t *pthread = threadParam; struct paraFetchData *pfd = NULL; -pthread_detach(*pthread); // this thread will never join back with it's progenitor - // Canceled threads that might leave locks behind, - // so the theads are detached and will be neither joined nor canceled. boolean allDone = FALSE; while(1) { pthread_mutex_lock( &pfdMutex ); if (!pfdList) { allDone = TRUE; } else { // move it from the waiting queue to the running queue pfd = slPopHead(&pfdList); slAddHead(&pfdRunning, pfd); } pthread_mutex_unlock( &pfdMutex ); if (allDone) @@ -4418,35 +4414,38 @@ } // Call the fac loader in parallel on all the bigDataUrl custom tracks // using pthreads to avoid long serial timeouts pthread_t *threads = NULL; if (doParallelLoad && (ptMax > 0)) // parallelFetch.threads=0 to disable parallel fetch { /* launch parallel threads */ ptMax = min(ptMax, slCount(pfdList)); if (ptMax > 0) { AllocArray(threads, ptMax); int pt; for (pt = 0; pt < ptMax; ++pt) { - int rc = pthread_create(&threads[pt], NULL, remoteParallelLoad, &threads[pt]); + int rc = pthread_create(&threads[pt], NULL, remoteParallelLoad, NULL); if (rc) { errAbort("Unexpected error %d from pthread_create(): %s",rc,strerror(rc)); } + pthread_detach(threads[pt]); // this thread will never join back with it's progenitor + // Canceled threads that might leave locks behind, + // so the threads are detached and will be neither joined nor canceled. } } } if (doParallelLoad && (ptMax > 0)) { /* wait for remote parallel load to finish */ remoteParallelLoadWait(atoi(cfgOptionDefault("parallelFetch.timeout", "90"))); // wait up to default 90 seconds. } struct slName *browserLines = customPpTakeBrowserLines(cpp); char *initialPos = browserLinePosition(browserLines); /* Finish off tracks -- add auxiliary settings, fill in some defaults, * and adjust priorities so tracks are not all on top of each other