Changeset 1873 for trunk/dll/treecnr.c


Ignore:
Timestamp:
Sep 26, 2015, 7:23:13 PM (10 years ago)
Author:
Gregg Young
Message:

Adjustments to ShowTreeRec to eliminate failures and reduce retries and container noise on tree switches. Remove fInitialDriveScan code. Changes to speed up ExpandAll. WaitFleshWorkListEmpty now gives error message and returns if semaphore request fails more than 5 consecutive times.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/treecnr.c

    r1871 r1873  
    108108                a thread. Loop and idle ExpandAll; Add CollapseAll; Move tree expand to a
    109109                thread; Have ShowTreeRec wait for the Flesh thread.
     110  26 Sep 15 GKY Adjustments to ShowTreeRec to eliminate failures and reduce retries and container
     111                noise on tree switches.
     112  26 Sep 15 GKY Remove fInitialDriveScan code
     113  26 Sep 15 GKY Changes to speed up ExpandAll
    110114
    111115***********************************************************************/
     
    191195BOOL fMiniLVM;
    192196BOOL fLVM;
     197BOOL fExpandAll;
    193198HPOINTER hptrDunno;
    194199HWND hwndMainMenu;
     
    203208static BOOL fOkayMinimize;
    204209static HMQ hmqExpandTree;
    205 static BOOL fExpandAll;
    206210
    207211APIRET16 APIENTRY16 Dos16MemAvail(PULONG pulAvailMem);
     
    305309  CHAR chSaved;
    306310
    307   //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec called for pszDir_ \"%s\"", pszDir_); // 2015-08-04 SHL FIXME debug
    308 
    309   strcpy(szDirArg, pszDir_);            // Cache here in case arg content changed by some other thread
    310 
     311  strcpy(szDirArg, pszDir_);    // Cache here in case arg content changed by some other thread
     312 
    311313  // already positioned to requested record?
    312314  pci = WinSendMsg(hwndCnr,
     
    314316                   MPFROMLONG(CMA_FIRST), MPFROMSHORT(CRA_CURSORED));
    315317  if (pci && (INT)pci != -1 && !stricmp(pci->pszFileName, szDirArg)) {
    316     found = TRUE;
    317318    quickbail = TRUE;                   // Already at requested record - bypass repositioning
    318319    goto MakeTop;
    319320  }
    320   // 2015-08-23 SHL FIXME to be gone - problem must be elsewhere
    321   // 2015-08-22 GKY Without this FM2 has NULL pci->pszFileName errors and switch failures
    322   if (fInitialDriveScan)
    323     DosSleep(100); // 100 still had errors
    324   if (fSwitchTreeOnDirChg)
    325     DosSleep(200);
    326 
    327321  // 2015-08-13 SHL add retry logic 2015-08-22 GKY increase retries from 10 to 100 to
    328322  // eliminate switch failures on deep or large tree state switches
     
    391385        }
    392386      }
    393 
    394       DosSleep(100);                    // 2015-08-13 SHL Let PM catch up
    395 
     387      WaitFleshWorkListEmpty(NULL);     // 2015-09-26 GKY Let Flesh thread catch up
    396388    } // while expanding
    397389
     
    404396    if (~pci->rc.flRecordAttr & CRA_CURSORED) {
    405397      if (collapsefirst) {
     398        WaitFleshWorkListEmpty(NULL);
    406399        pciP = WinSendMsg(hwndCnr,
    407400                          CM_QUERYRECORD,
     
    447440      }
    448441      if (maketop || fTopDir) {
    449         if (fCollapseFirst)
     442        if (fCollapseFirst && !quickbail) {
    450443          WaitFleshWorkListEmpty(NULL); //Let the root expand first otherwise it makes top
     444        }
    451445        // 2015-08-23 SHL FIXME debug
    452         //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec ShowCnrRecord(%p) fTopDir %i maketop %i", pciToSelect, fTopDir, maketop); // 2015-08-04 SHL FIXME debug
     446        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec ShowCnrRecord(%p) filename %s", pciToSelect, pciToSelect->pszFileName); // 2015-08-04 SHL FIXME debug
    453447        ShowCnrRecord(hwndCnr, (PMINIRECORDCORE)pciToSelect);
    454448      }
     
    759753#endif
    760754          //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling ShowTreeRec(\"%s\")", mp1); // 2015-08-04 SHL FIXME debug
    761           ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
    762           //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling PostMsg(IDM_UPDATE)"); // 2015-08-04 SHL FIXME debug
     755          priority_idle(); // 2015-09-26 GKY Majority of work done by Flesh and UI threads
     756          ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
     757          priority_normal();
     758          //DbgMsg(pszSrcFile, __LINE__, "TreeObjWndProc UM_SHOWME calling PostMsg(IDM_UPDATE)"); // 2015-08-04 SHL FIXME debug
    763759          PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    764760
     
    34373433                    driveserial[toupper(*pci->pszFileName) - 'A'] !=
    34383434                    volser.serial)
    3439                 { // 2015-08-28 GKY fixme? I think this code runs on the UI thread
     3435                {
    34403436                  WaitFleshWorkListEmpty(pci->pszFileName);     // 2015-08-19 SHL in case pci still in work list
    34413437                  AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
     
    34463442                     volser.serial)) {
    34473443                  if (qmsg.msg == UM_EXPANDTREE && AddFleshWorkRequest(dcd->hwndCnr, pci, eFlesh)
    3448                       && !dcd->suspendview  && fTopDir) {
     3444                      && !dcd->suspendview  && fTopDir && !fSwitchTreeOnDirChg) {
    34493445                    DosSleep(1);
    34503446                    WaitFleshWorkListEmpty(pci->pszFileName);
     
    34563452              else {
    34573453                driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    3458                 // 2015-08-28 GKY fixme? I think this code runs on the UI thread
    34593454                WaitFleshWorkListEmpty(pci->pszFileName);       // 2015-08-19 SHL in case pci still in work list
    34603455                AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
Note: See TracChangeset for help on using the changeset viewer.