Changeset 1873 for trunk/dll


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.

Location:
trunk/dll
Files:
8 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.c

    r1870 r1873  
    28642864                  // 2015-08-07 SHL FIXME to wait for Flesh to finish before PostMsg
    28652865                  if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && AddFleshWorkRequest(hwnd, pci, eFlesh) &&
    2866                       !dcd->suspendview && fTopDir ) {
     2866                      !dcd->suspendview && fTopDir  && !fSwitchTreeOnDirChg) {
    28672867                    PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    28682868                    //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
     
    28732873            }
    28742874            else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
    2875               if (AddFleshWorkRequest(hwnd, pci, eFlesh) && !dcd->suspendview && fTopDir) {
     2875              if (AddFleshWorkRequest(hwnd, pci, eFlesh) && !dcd->suspendview &&
     2876                  fTopDir && !fSwitchTreeOnDirChg) {
    28762877                // 2015-08-07 SHL FIXME to wait for Flesh to finish before PostMsg
    28772878                PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
  • trunk/dll/filldir.c

    r1871 r1873  
    123123                use of NULL/Nullstr pszFileNames by Stubby). Add code to relink pci chain
    124124                following rename, delete, etc. Add "Expanding" window text.
     125  26 Sep 15 GKY Remove fInitialDriveScan code
    125126
    126127***********************************************************************/
     
    908909      do {
    909910        /**
    910          * remove . and .. from list if present
     911         * remove . and .. and directories already added
     912         * by Stubby from list if present
    911913         * also counter file system bugs that sometimes
    912914         * allows normal files to slip through when
     
    11831185
    11841186    // 13 Oct 09 SHL FIXME to be saymsg if ERROR_NOT_READY and first try on volume
    1185     if (rc && rc != ERROR_NO_MORE_FILES && (fDontSuggestAgain || !fInitialDriveScan)) {
     1187    if (rc && rc != ERROR_NO_MORE_FILES && fDontSuggestAgain) {
    11861188      Dos_Error(MB_ENTER, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    11871189                GetPString(IDS_CANTFINDDIRTEXT), pszFileSpec);
     
    16881690
    16891691  DosSleep(16);
    1690 
    1691   fInitialDriveScan = FALSE;
    1692   //DbgMsg(pszSrcFile, __LINE__, "fInitialDriveScan now FALSE");         // 2015-08-03 SHL FIXME debug
    16931692  DosPostEventSem(CompactSem);
    16941693
     
    16971696    BOOL includesyours = FALSE;
    16981697
    1699     // 02 Mar 14 GKY !didone for fFirstTime so it works again
     1698    // 02 Mar 14 GKY !didonce for fFirstTime so it works again
    17001699   if (*szSuggest || ~driveflags[1] & DRIVE_IGNORE && !didonce) {
    17011700      if (!DosDevConfig(&info, DEVINFO_FLOPPY) && info == 1) {
  • trunk/dll/flesh.c

    r1871 r1873  
    4141                complete container item. Add a flag to indicate when a directory needed to be
    4242                Fleshed
     43  26 Sep 15 GKY Changes to speed up ExpandAll
     44  26 Sep 15 GKY WaitFleshWorkListEmpty now gives error message and returns if semaphore request
     45                fails more than 5 consecutive times.
    4346
    4447***********************************************************************/
     
    7477#include "common.h"                     // IncrThreadUsage DecrThreadUsage
    7578#include "pathutil.h"
     79#include "treecnr.h"                    // fExpandAll
    7680#if 0
    7781#define  __PMPRINTF__
     
    863867  BOOL waited;
    864868  PCSZ pszSavedFleshFocusPath;
     869  INT rcCount = 0;
    865870
    866871  if (tid == 1 || tid == tidFleshWorkListThread) {
     
    902907    if (pszDirName) {
    903908      rc = xDosRequestMutexSem(hmtxFleshWork, SEM_INDEFINITE_WAIT);
    904       if (rc)
    905         continue;                       // Maybe should return ???
     909      if (rc) {
     910        rcCount++;
     911        if (rcCount < 6)
     912          continue;                     // Maybe should return ???
     913        else {
     914          Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     915                    PCSZ_DOSREQUESTMUTEXSEM);
     916          return;
     917        }
     918
     919      }
    906920
    907921      if (!pathSaved) {
     
    915929
    916930      xDosReleaseMutexSem(hmtxFleshWork);
     931      rcCount = 0;
    917932
    918933      if (!item) {
    919934        if (waited)
    920           DosSleep(100);                // Let PM do some work
     935          DosSleep(fExpandAll ? 1 : 240);               // Let PM do some work
    921936        break;                          // Dependents gone from work list
    922937      }
    923938    } // if pszDirName
    924 
    925     DosSleep(250);
     939    DosSleep(fExpandAll ? 10 : 250);
    926940  } // for
    927941
  • trunk/dll/init.c

    r1871 r1873  
    140140  24 Aug 15 GKY Remove obsolete code fDontAsk?zip
    141141  20 Sep 15 GKY Move tree expand to a thread.
     142  26 Sep 15 GKY Remove fInitialDriveScan code
    142143 
    143144***********************************************************************/
     
    255256ULONG ulDateFmt;
    256257BOOL fDontSuggestAgain;
    257 BOOL fInitialDriveScan;
    258258BOOL fAmAV2;
    259259BOOL fChangeTarget;
     
    12111211    fSwitchTreeExpand = fNoSearch = fCustomFileDlg = fOtherHelp =
    12121212    fSaveMiniCmds = fUserComboBox = fFM2Deletes = fConfirmTarget =
    1213     fShowTarget = fDrivebarHelp = fCheckMM = fInitialDriveScan =
    1214     fEjectRemovableScan = TRUE;
     1213    fShowTarget = fDrivebarHelp = fCheckMM = fEjectRemovableScan = TRUE;
    12151214  ulCnrType = CCS_EXTENDSEL;
    12161215  FilesToGet = FILESTOGET_MAX;
  • trunk/dll/init.h

    r1868 r1873  
    215215extern PCSZ WC_VIEWSTATUS;
    216216extern BOOL fDontSuggestAgain;
    217 extern BOOL fInitialDriveScan;
    218217extern BOOL fAmAV2;
    219218extern BOOL fChangeTarget;
  • trunk/dll/select.c

    r1872 r1873  
    3838                in UM_EXPAND until until drive is completely expanded. Changes were need to
    3939                work with Flesh, Stubby and UnFlesh being moved to a thread
     40  26 Sep 15 GKY Changes to speed up ExpandAll
    4041
    4142***********************************************************************/
     
    572573{
    573574  PCNRITEM pci;
    574   static BOOL fExpanding = FALSE;
     575  static BOOL fExpanding = FALSE; // statics are only used by tree container
    575576  static INT counter = 1;
    576577
     
    596597      if (count != 0) {
    597598        fExpanding = TRUE;
     599        if (IsFleshWorkListEmpty())
     600          DosSleep(0);       // Yield to EXPANDTREE and Flesh thread
    598601        if (!IsFleshWorkListEmpty()) {
    599602          WaitFleshWorkListEmpty(NULL); // Let it expand
     
    609612    }
    610613  }
    611   //DosSleep(0);
    612614  return fExpanding;
    613615}
  • 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);
  • trunk/dll/treecnr.h

    r1871 r1873  
    4545extern BOOL fMiniLVM;
    4646extern BOOL fLVM;
     47extern BOOL fExpandAll;
    4748extern HPOINTER hptrDunno;
    4849extern HWND hwndMainMenu;
Note: See TracChangeset for help on using the changeset viewer.