void AnchorData_ClearAll(EERIE_BACKGROUND * eb) { // EERIE_PATHFINDER_Release(); EERIE_PATHFINDER_Clear(); for(long j = 0; j < eb->Zsize; j++) { for(long i = 0; i < eb->Xsize; i++) { EERIE_BKG_INFO * eg = &eb->fastdata[i][j]; if(eg->nbianchors && eg->ianchors) free(eg->ianchors); eg->nbianchors = 0; eg->ianchors = NULL; } } if(eb->anchors && eb->nbanchors) { for(int j = 0; j < eb->nbanchors; j++) { if(eb->anchors[j].nblinked && eb->anchors[j].linked) { free(eb->anchors[j].linked); eb->anchors[j].linked = NULL; } } free(eb->anchors); } eb->anchors = NULL; eb->nbanchors = 0; }
void EERIE_PATHFINDER_Release() { if (!PATHFINDER) return; CURPATHFINDIO = NULL; while (WaitForSingleObject(PATHFINDER_MUTEX, PATHFINDER_RELEASE_WAIT) == WAIT_TIMEOUT) Sleep(1); EERIE_PATHFINDER_Clear(1); bExitPathfinderThread = true; while (WaitForSingleObject(PATHFINDER, PATHFINDER_RELEASE_WAIT) == WAIT_TIMEOUT) Sleep(1); CloseHandle(PATHFINDER), PATHFINDER = NULL; ReleaseMutex(PATHFINDER_MUTEX), CloseHandle(PATHFINDER_MUTEX), PATHFINDER_MUTEX = NULL; }
//************************************************************************************* // Clears all Anchor data from a Background //************************************************************************************* void AnchorData_ClearAll(EERIE_BACKGROUND * eb) { // EERIE_PATHFINDER_Release(); EERIE_PATHFINDER_Clear(); EERIE_BKG_INFO * eg; for (long j = 0; j < eb->Zsize; j++) for (long i = 0; i < eb->Xsize; i++) { eg = &eb->Backg[i+j*eb->Xsize]; if ((eg->nbianchors) && (eg->ianchors)) free(eg->ianchors); eg->nbianchors = 0; eg->ianchors = NULL; } if ((eb->anchors) && (eb->nbanchors)) { for (int j = 0; j < eb->nbanchors; j++) { if ((eb->anchors[j].nblinked) && (eb->anchors[j].linked)) { free((void *)eb->anchors[j].linked); eb->anchors[j].linked = NULL; } } free((void *)eb->anchors); } eb->anchors = NULL; eb->nbanchors = 0; }