Changeset 1570 for trunk/dll/filldir.c


Ignore:
Timestamp:
Jun 13, 2011, 12:09:19 AM (14 years ago)
Author:
Gregg Young
Message:

Added IdleIfNeeded to place load and free loops to idle priority when dealing with large numbers of items. Used SleepIfNeeded more places for a similar purpose.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/filldir.c

    r1567 r1570  
    9595  30 May 11 GKY Added SleepIfNeeded to DosFind and container load loops to improve WPS responsiveness
    9696  31 May 11 SHL Disable antique debug code in RemoveCnrItems - really speeds up container close
     97  12 Jun 11 GKY Added IdleIfNeeded to the container "free" loops to improve system
     98                responsiveness when closing containers with large numbers of items
     99  12 Jun 11 GKY Replaced SleepIfNeeded with IdleIfNeeded in the container loade loop
    97100
    98101***********************************************************************/
     
    986989                       &ulFindCnt,
    987990                       FIL_QUERYEASIZEL);
    988     //priority_normal();
     991    priority_normal();
    989992    pszFileSpec[strlen(pszFileSpec) - 1] = 0;   // Chop off wildcard
    990993    if (!rc) {
     
    11131116        ulFindCnt = ulFindMax;
    11141117        rc = xDosFindNext(hdir, paffbFound, ulBufBytes, &ulFindCnt, FIL_QUERYEASIZEL);
    1115         //priority_normal();
     1118        priority_normal();
    11161119        if (rc)
    11171120          DosError(FERR_DISABLEHARDERR);
     
    11301133          goto Abort;
    11311134
     1135        InitITimer(&itdSleep, 500);
    11321136        pci = NULL;
    11331137        ullTotalBytes = 0;
     
    11691173          pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
    11701174
     1175          if (!IdleIfNeeded(&itdSleep, 30)) {
     1176            for (x = x+1; x < cAffbTotal; x++) {
     1177              ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
     1178                                          pffbFile, partial, dcd);
     1179              pci = (PCNRITEM) pci->rc.preccNextRecord;
     1180              ullTotalBytes += ullBytes;
     1181              if (dcd) {
     1182                dcd->totalfiles = x;
     1183                dcd->ullTotalBytes = ullTotalBytes;
     1184              }
     1185              pffbFile = (PFILEFINDBUF4L)((PBYTE)pffbFile + sizeof(FILEFINDBUF4L));
     1186              if (pci == NULL) {
     1187                priority_normal();
     1188                InitITimer(&itdSleep, 500);
     1189                break;
     1190              }
     1191            }
     1192          }
     1193
    11711194          if (pci == NULL && ulRecsToInsert) {
    11721195            memset(&ri, 0, sizeof(RECORDINSERT));
     
    11951218            }
    11961219          }
    1197           SleepIfNeeded(&itdSleep, 1);
    1198         }
     1220          //SleepIfNeeded(&itdSleep, 1);
     1221        }
     1222        priority_normal();
    11991223        if (ok) {
    12001224          ullReturnBytes += ullTotalBytes;
     
    19852009    FreeCnrItemData(pci);
    19862010    pci = pciNext;
    1987     SleepIfNeeded(&itdSleep, 1);
    1988   }
    1989 
     2011    if (!IdleIfNeeded(&itdSleep, 30)) {
     2012      for (usCount = usCount + 1; pci; usCount++) {
     2013        pciNext = (PCNRITEM) pci->rc.preccNextRecord;
     2014        FreeCnrItemData(pci);
     2015        pci = pciNext;
     2016      }
     2017      break;
     2018    }
     2019  }
     2020  priority_normal();
     2021  DosPostEventSem(CompactSem);
    19902022  if (usCount) {
    19912023    if (!WinSendMsg(hwnd, CM_FREERECORD, MPFROMP(&pci), MPFROMSHORT(usCount))) {
     
    20452077        if (remaining && --remaining == 0)
    20462078          break;
    2047         SleepIfNeeded(&itdSleep, 1);
    2048       }
     2079        if (!IdleIfNeeded(&itdSleep, 30)) {
     2080          while (pci) {
     2081            FreeCnrItemData(pci);
     2082            pci = (PCNRITEM)pci->rc.preccNextRecord;
     2083            if (remaining && --remaining == 0)
     2084              break;
     2085          }
     2086        }
     2087      }
     2088      priority_normal();
     2089      DosPostEventSem(CompactSem);
    20492090    }
    20502091  }
Note: See TracChangeset for help on using the changeset viewer.