20d2f29ca6491f11c70c95e041220fe72c37a2dd galt Sun Dec 22 15:06:45 2024 -0800 fix compiler warning about about restrict keywords in pthread_create. diff --git src/hg/hgBlat/hgBlat.c src/hg/hgBlat/hgBlat.c index 21511f1..cea76dd 100644 --- src/hg/hgBlat/hgBlat.c +++ src/hg/hgBlat/hgBlat.c @@ -166,38 +166,34 @@ { return (b->maxGeneHits - a->maxGeneHits); } } else return result; } // === parallel code ==== void queryServerFinish(struct genomeHits *gH); // Forward declaration static pthread_mutex_t pfdMutex = PTHREAD_MUTEX_INITIALIZER; static struct genomeHits *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 genomeHits *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) @@ -2246,35 +2242,38 @@ pthread_t *threads = NULL; pfdListCount = slCount(pfdList); if (pfdListCount > 0) { /* launch parallel threads */ ptMax = min(ptMax, pfdListCount); if (ptMax > 0) { AllocArray(threads, ptMax); /* Create threads */ 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 (ptMax > 0) { /* wait for remote parallel load to finish */ remoteParallelLoadWait(atoi(cfgOptionDefault("parallelFetch.timeout", "90"))); // wait up to default 90 seconds. } // Should continue with pfdDone since threads could still be running that might access pdfList ? // Hide weaker of RC'd query pairs, if not debugging. // Combine pairs with a query and its RC. if (!(debuggingGfResults) && (sameString(pfdDone->xType,"dna") || sameString(pfdDone->xType,"dnax")))