Changeset 1874


Ignore:
Timestamp:
Sep 27, 2015, 7:20:10 PM (10 years ago)
Author:
Gregg Young
Message:

DosSleep times in WaitFleshWorkListEmpty set by caller; TOPDIR code calls WaitFleshWorkListEmpty before ShowCnrRecord and now actually exists for directory containers in tree view. These calls are made from the object windows.

Location:
trunk/dll
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.c

    r1873 r1874  
    9393                duplicate subdirectory name caused by running Stubby in worker threads.
    9494  07 Aug 15 SHL Rework to use AddFleshWorkRequest rather than direct calls to Stubby/Flesh/Unflesh
     95  26 Sep 15 GKY Add code so case UM_TOPDIR actually exists put it in the object window so it
     96                can call WaitFleshWorkListEmpty while avoiding thread 1
     97  27 Sep 15 GKY DosSleep times in WaitFleshWorkListEmpty set by caller
    9598
    9699***********************************************************************/
     
    856859    return 0;
    857860
     861  case UM_TOPDIR:
     862    if (mp1) {
     863      dcd = WinQueryWindowPtr(hwnd, QWL_USER);
     864      if (dcd) {
     865        PCNRITEM pci = (PCNRITEM) mp1;
     866        WaitFleshWorkListEmpty(pci->pszFileName, 240L);
     867        ShowCnrRecord(dcd->hwndCnr, (PMINIRECORDCORE) pci);
     868      }
     869    }
     870    return 0;
     871
    858872  case UM_RESCAN:
    859873    // populate container
     
    28622876                     driveserial[toupper(*pci->pszFileName) - 'A'] !=
    28632877                     volser.serial)) {
    2864                   // 2015-08-07 SHL FIXME to wait for Flesh to finish before PostMsg
     2878                  // 2015-08-07 SHL FIXME to wait for Flesh to finish before PostMsg
     2879                  // 2015-09-26 GKY Waits (WaitFleshWorkListEmpty) in object window
     2880                  DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    28652881                  if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && AddFleshWorkRequest(hwnd, pci, eFlesh) &&
    2866                       !dcd->suspendview && fTopDir  && !fSwitchTreeOnDirChg) {
    2867                     PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    2868                     //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
     2882                      !dcd->suspendview && fTopDir) {
     2883                    PostMsg(dcd->hwndObject, UM_TOPDIR, MPFROMP(pci), MPVOID);
     2884                    DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    28692885                  }
    28702886                }
     
    28722888              }
    28732889            }
    2874             else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
     2890            else if (SHORT2FROMMP(mp1) == CN_EXPANDTREE) {
     2891              DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    28752892              if (AddFleshWorkRequest(hwnd, pci, eFlesh) && !dcd->suspendview &&
    2876                   fTopDir && !fSwitchTreeOnDirChg) {
    2877                 // 2015-08-07 SHL FIXME to wait for Flesh to finish before PostMsg
    2878                 PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    2879                 //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
     2893                  fTopDir) {
     2894                // 2015-08-07 SHL FIXME to wait for Flesh to finish before PostMsg
     2895                // 2015-09-26 GKY Waits (WaitFleshWorkListEmpty) in object window
     2896                PostMsg(dcd->hwndObject, UM_TOPDIR, MPFROMP(pci), MPVOID);
     2897                DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
    28802898              }
    28812899            }
  • trunk/dll/flesh.c

    r1873 r1874  
    4444  26 Sep 15 GKY WaitFleshWorkListEmpty now gives error message and returns if semaphore request
    4545                fails more than 5 consecutive times.
     46  27 Sep 15 GKY DosSleep times in WaitFleshWorkListEmpty set by caller
    4647
    4748***********************************************************************/
     
    263264                                MPFROMP(pciParent),
    264265                                MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    265     // No children or filename null
     266    // Added by Stubby to create plus sign run Stubby on it here and skip it in ProcessDirectory
    266267    if (pciL && (INT)pciL != -1) {
    267268      AddFleshWorkRequest(hwndCnr, pciL, eStubby);
    268       // 2015-08-06 SHL FIXME to ensure this an not happen
     269      // 2015-08-06 SHL FIXME to ensure this can not happen
    269270      if (!*pciL->pszFileName || !strcmp(pciL->pszFileName, NullStr))
    270271        Runtime_Error(pszSrcFile, __LINE__, "Flesh called with pci %p pszFileName (null)", pciL);
     
    856857
    857858#ifndef WaitFleshWorkListEmpty // 2015-08-03 SHL FIXME debug
    858 VOID WaitFleshWorkListEmpty(PCSZ pszDirName)
     859VOID WaitFleshWorkListEmpty(PCSZ pszDirName, ULONG ulSleep)
    859860#else
    860 VOID WaitFleshWorkListEmptyDbg(PCSZ pszDirName, PCSZ pszSrcFile_, UINT uSrcLineNo_)
     861VOID WaitFleshWorkListEmptyDbg(PCSZ pszDirName, ULONG ulSleep, PCSZ pszSrcFile_, UINT uSrcLineNo_)
    861862#endif
    862863{
     
    933934      if (!item) {
    934935        if (waited)
    935           DosSleep(fExpandAll ? 1 : 240);               // Let PM do some work
     936          DosSleep(ulSleep);            // Let PM do some work
    936937        break;                          // Dependents gone from work list
    937938      }
    938939    } // if pszDirName
    939     DosSleep(fExpandAll ? 10 : 250);
     940    DosSleep(ulSleep);
    940941  } // for
    941942
  • trunk/dll/flesh.h

    r1863 r1874  
    1212  19 Aug 15 SHL Allow WaitFleshWorkListEmpty to wait for dependent items
    1313  22 Aug 15 GKY Remove recurse scan code.
     14  27 Sep 15 GKY DosSleep times in WaitFleshWorkListEmpty set by caller
    1415
    1516***********************************************************************/
     
    2728
    2829#if 0 // 2015-08-03 SHL FIXME debug
    29 VOID WaitFleshWorkListEmpty(PCSZ pszDirName);
     30VOID WaitFleshWorkListEmpty(PCSZ pszDirName, ULONG ulSleep);
    3031#else
    31 #define WaitFleshWorkListEmpty(pszDirName) WaitFleshWorkListEmptyDbg(pszDirName, __FILE__, __LINE__)
    32 VOID WaitFleshWorkListEmptyDbg(PCSZ pszDirName, PCSZ pszSrcFile, UINT uSrcLineNo);
     32#define WaitFleshWorkListEmpty(pszDirName, ulSleep) WaitFleshWorkListEmptyDbg(pszDirName, ulSleep, __FILE__, __LINE__)
     33VOID WaitFleshWorkListEmptyDbg(PCSZ pszDirName, ULONG ulSleep, PCSZ pszSrcFile, UINT uSrcLineNo);
    3334#endif
    3435
  • trunk/dll/select.c

    r1873 r1874  
    3939                work with Flesh, Stubby and UnFlesh being moved to a thread
    4040  26 Sep 15 GKY Changes to speed up ExpandAll
     41  27 Sep 15 GKY DosSleep times in WaitFleshWorkListEmpty set by caller
    4142
    4243***********************************************************************/
     
    600601          DosSleep(0);       // Yield to EXPANDTREE and Flesh thread
    601602        if (!IsFleshWorkListEmpty()) {
    602           WaitFleshWorkListEmpty(NULL); // Let it expand
     603          WaitFleshWorkListEmpty(NULL, 10); // Let it expand
    603604        }
    604605      }
     
    606607    while (pci && (INT)pci != -1) {
    607608      ExpandAll(hwndCnr, count, pci);
    608       if (!IsFleshWorkListEmpty())
    609         WaitFleshWorkListEmpty(NULL); // Wait for container to catch up
     609      if (count != 0 && !IsFleshWorkListEmpty())
     610        WaitFleshWorkListEmpty(NULL, 10); // Wait for container to catch up
    610611      pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
    611612                                  MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
  • trunk/dll/treecnr.c

    r1873 r1874  
    112112  26 Sep 15 GKY Remove fInitialDriveScan code
    113113  26 Sep 15 GKY Changes to speed up ExpandAll
     114  26 Sep 15 GKY Put UM_TOPDIR in the object window so it can call WaitFleshWorkListEmpty
     115                while avoiding thread 1
     116  27 Sep 15 GKY DosSleep times in WaitFleshWorkListEmpty set by caller
    114117
    115118***********************************************************************/
     
    353356      if (!pciP || (INT)pciP == -1) {
    354357        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec FindCnrRecord(\"%s\") returned pciP %p", szDir, pciP); // 2015-08-04 SHL FIXME debug
    355         WaitFleshWorkListEmpty(szDirArg);       // 2015-08-23 SHL
     358        WaitFleshWorkListEmpty(szDirArg, 240);  // 2015-08-23 SHL
    356359        break;                                  // No match
    357360      }
     
    385388        }
    386389      }
    387       WaitFleshWorkListEmpty(NULL);     // 2015-09-26 GKY Let Flesh thread catch up
     390      WaitFleshWorkListEmpty(NULL, 240);     // 2015-09-26 GKY Let Flesh thread catch up
    388391    } // while expanding
    389392
     
    396399    if (~pci->rc.flRecordAttr & CRA_CURSORED) {
    397400      if (collapsefirst) {
    398         WaitFleshWorkListEmpty(NULL);
     401        WaitFleshWorkListEmpty(NULL, 240);
    399402        pciP = WinSendMsg(hwndCnr,
    400403                          CM_QUERYRECORD,
     
    441444      if (maketop || fTopDir) {
    442445        if (fCollapseFirst && !quickbail) {
    443           WaitFleshWorkListEmpty(NULL); //Let the root expand first otherwise it makes top
     446          WaitFleshWorkListEmpty(NULL, 240); //Let the root expand first otherwise it makes top
    444447        }
    445448        // 2015-08-23 SHL FIXME debug
     
    449452
    450453      if (!quickbail) {
    451         WaitFleshWorkListEmpty(szDirArg);       // 2015-08-19 SHL try to ensure contents stable
     454        WaitFleshWorkListEmpty(szDirArg, 240);  // 2015-08-19 SHL try to ensure contents stable
    452455        //DbgMsg(pszSrcFile, __LINE__, "ShowTreeRec WinSendMsg(CM_SETRECORDEMPHASIS, CRA_SELECTED | CRA_CURSORED) szDirArg \"%s\"", szDirArg); // 2015-08-04 SHL FIXME debug
    453456        WinSendMsg(hwndCnr,
     
    771774    return 0;
    772775
     776  case UM_TOPDIR:
     777    if (mp1) {
     778      dcd = INSTDATA(hwnd);
     779      if (dcd) {
     780        PCNRITEM pci = (PCNRITEM) mp1;
     781        WaitFleshWorkListEmpty(pci->pszFileName, 240);
     782        ShowCnrRecord(dcd->hwndCnr, (PMINIRECORDCORE) pci);
     783      }
     784    }
     785    return 0;
     786
    773787  case DM_PRINTOBJECT:
    774788    return MRFROMLONG(DRR_TARGET);
     
    813827          x++;
    814828          if (!IsFleshWorkListEmpty()) {
    815             WaitFleshWorkListEmpty(NULL); // Let it expand
     829            WaitFleshWorkListEmpty(NULL, 10); // Let it expand
    816830          }
    817831          fExpanding = ExpandAll(dcd->hwndCnr, x, (PCNRITEM) mp2);
     
    967981            pci = FindParentRecord(dcd->hwndCnr, pci);
    968982            driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    969             WaitFleshWorkListEmpty(pci->pszFileName);   // 2015-08-19 SHL in case pci still in work list
     983            WaitFleshWorkListEmpty(pci->pszFileName, 240);      // 2015-08-19 SHL in case pci still in work list
    970984            AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
    971985          }
     
    19591973  case UM_TOPDIR:
    19601974    if (mp1) {
    1961       PCNRITEM pci = (PCNRITEM) mp1;
    1962       ShowCnrRecord(hwnd, (PMINIRECORDCORE) pci);
     1975      PostMsg(dcd->hwndObject, UM_TOPDIR, mp1, MPVOID);
    19631976    }
    19641977    return 0;
     
    20772090          else {
    20782091            driveserial[x] = -1;
    2079             //WaitFleshWorkListEmpty(NULL);     // 2015-08-13 SHL in case pci still in work list
     2092            //WaitFleshWorkListEmpty(NULL, 10); // 2015-08-13 SHL in case pci still in work list
    20802093            AddFleshWorkRequest(hwnd, pci, eUnFlesh);
    20812094            PostMsg(hwnd, UM_RESCAN, MPVOID, MPVOID);
     
    34333446                    driveserial[toupper(*pci->pszFileName) - 'A'] !=
    34343447                    volser.serial)
    3435                 { 
    3436                   WaitFleshWorkListEmpty(pci->pszFileName);     // 2015-08-19 SHL in case pci still in work list
     3448                {
     3449                  WaitFleshWorkListEmpty(pci->pszFileName, 10); // 2015-08-19 SHL in case pci still in work list
    34373450                  AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
    34383451                }
     
    34413454                     driveserial[toupper(*pci->pszFileName) - 'A'] !=
    34423455                     volser.serial)) {
     3456                  WaitFleshWorkListEmpty(pci->pszFileName, 10); // 2015-08-19 SHL in case pci still in work list
    34433457                  if (qmsg.msg == UM_EXPANDTREE && AddFleshWorkRequest(dcd->hwndCnr, pci, eFlesh)
    3444                       && !dcd->suspendview  && fTopDir && !fSwitchTreeOnDirChg) {
    3445                     DosSleep(1);
    3446                     WaitFleshWorkListEmpty(pci->pszFileName);
     3458                      && !dcd->suspendview  && fTopDir) {
    34473459                    PostMsg(dcd->hwndCnr, UM_TOPDIR, MPFROMP(pci), MPVOID);
    34483460                  }
     
    34523464              else {
    34533465                driveserial[toupper(*pci->pszFileName) - 'A'] = -1;
    3454                 WaitFleshWorkListEmpty(pci->pszFileName);       // 2015-08-19 SHL in case pci still in work list
     3466                WaitFleshWorkListEmpty(pci->pszFileName, 10);   // 2015-08-19 SHL in case pci still in work list
    34553467                AddFleshWorkRequest(dcd->hwndCnr, pci, eUnFlesh);
    34563468                PostMsg(dcd->hwndCnr, UM_RESCAN, MPVOID, MPVOID);
     
    34663478                DosSleep(1);
    34673479              else {
    3468                 while (!IsFleshWorkListEmpty())
    3469                   DosSleep(10); //Yield to Flesh thread
     3480                WaitFleshWorkListEmpty(pci->pszFileName, 10);   // 2015-08-19 SHL in case pci still in work list
    34703481              }
    34713482              AddFleshWorkRequest(dcd->hwndCnr, pci, eFlesh);   // forceFlesh
    3472               if (!dcd->suspendview && fTopDir && !fSwitchTreeOnDirChg) {
     3483              if (!dcd->suspendview && fTopDir) {
    34733484                //DbgMsg(pszSrcFile, __LINE__, "TreeCnrWndProc UM_TOPDIR %p pci %p %s",
    34743485                //       qmsg.hwnd, pci, pci->pszFileName);  // 2015-08-04 SHL FIXME debug
Note: See TracChangeset for help on using the changeset viewer.