Changeset 1553


Ignore:
Timestamp:
Nov 20, 2010, 10:18:32 PM (15 years ago)
Author:
Gregg Young
Message:

Rework scanning code to remove redundant scans, prevent double directory entries in the tree container, fix related semaphore performance using combination of event and mutex semaphores

Location:
trunk/dll
Files:
5 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.c

    r1551 r1553  
    7878  28 May 10 GKY Yet another attempt to prevent duplicate directory names in the tree by
    7979                suppressing SHOW_ME during initial drive scan.
     80  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
     81                entries in the tree container, fix related semaphore performance using
     82                combination of event and mutex semaphores
    8083
    8184***********************************************************************/
     
    28212824                     driveserial[toupper(*pci->pszFileName) - 'A'] !=
    28222825                     volser.serial)) {
    2823                   if (Flesh(hwnd, pci) &&
    2824                       SHORT2FROMMP(mp1) == CN_EXPANDTREE &&
    2825                       !dcd->suspendview && fTopDir) {
     2826                  if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && Flesh(hwnd, pci) &&
     2827                      !dcd->suspendview && fTopDir ) {
    28262828                    PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    28272829                    //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
  • trunk/dll/filldir.c

    r1551 r1553  
    8484  15 Nov 09 GKY Avoid szBuf overflow in FillTreeCnr
    8585  15 Nov 09 GKY Optimize some check code
    86   17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
    87   09 MAY 10 JBS Ticket 434 bug fixes, message box text improvements and parameter update improvements.
     86  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10).
     87                Mostly cast CHAR CONSTANT * as CHAR *.
     88  09 MAY 10 JBS Ticket 434 bug fixes, message box text improvements and parameter update
     89                improvements.
     90  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
     91                entries in the tree container, fix related semaphore performance using
     92                combination of event and mutex semaphores
    8893
    8994***********************************************************************/
     
    262267         ProcessDirCount, FixedVolume);
    263268  if (ProcessDirCount >= FixedVolume) {
     269    DosReleaseMutexSem(hmtxScanning);
    264270    DosPostEventSem(hevTreeCnrScanComplete);
    265271    if (fInitialDriveScan && fSwitchTree && hwndTree && fSaveState && pszFocusDir) {
  • trunk/dll/init.c

    r1551 r1553  
    9898  09 MAY 10 JBS Ticket 434: Make fDontSuggestAgain a "global" flag, not a per app flag
    9999  23 Oct 10 GKY Changes to populate and utilize a HELPTABLE for context specific help
     100  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
     101                entries in the tree container, fix related semaphore performance using
     102                combination of event and mutex semaphores
    100103
    101104***********************************************************************/
     
    196199HMTX hmtxFM2Delete;
    197200HMTX hmtxFM2Globals;
     201HMTX hmtxScanning;
    198202HEV  hevTreeCnrScanComplete;
    199203ULONG OS2ver[2];
     
    11081112  if (DosCreateMutexSem(NULL, &hmtxFM2Globals, 0L, FALSE))
    11091113    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     1114              PCSZ_DOSCREATEMUTEXSEM);
     1115  if (DosCreateMutexSem(NULL, &hmtxScanning, 0L, FALSE))
     1116    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    11101117              PCSZ_DOSCREATEMUTEXSEM);
    11111118  if (DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE))
  • trunk/dll/init.h

    r1551 r1553  
    2323                inappropriate menu context choices
    2424  15 Nov 09 GKY Add more PCSZs
    25   17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10). Mostly cast CHAR CONSTANT * as CHAR *.
     25  17 JAN 10 GKY Changes to get working with Watcom 1.9 Beta (1/16/10).
     26                Mostly cast CHAR CONSTANT * as CHAR *.
     27  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
     28                entries in the tree container, fix related semaphore performance using
     29                combination of event and mutex semaphores
    2630
    2731***********************************************************************/
     
    207211extern HMTX hmtxFM2Globals;
    208212extern HMTX hmtxFM2Delete;
     213extern HMTX hmtxScanning;
    209214extern HEV  hevTreeCnrScanComplete;
    210215#endif
  • trunk/dll/treecnr.c

    r1552 r1553  
    8484  11 Apr 10 GKY Fix drive tree rescan failure and program hang caused by event sem
    8585                never being posted
     86  20 Nov 10 GKY Rework scanning code to remove redundant scans, prevent double directory
     87                entries in the tree container, fix related semaphore performance using
     88                combination of event and mutex semaphores
    8689
    8790***********************************************************************/
     
    644647      dcd = INSTDATA(hwnd);
    645648      if (dcd) {
    646         BOOL tempsusp, tempfollow, temptop;
     649        BOOL tempsusp, tempfollow, temptop;
    647650
    648651        DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     
    656659        }
    657660        ShowTreeRec(dcd->hwndCnr, (CHAR *)mp1, fCollapseFirst, TRUE);
    658         // fixme Is this PostMsg needed if recursive scan has already been done?
    659661        PostMsg(hwndTree, WM_COMMAND, MPFROM2SHORT(IDM_UPDATE, 0), MPVOID);
    660662        dcd->suspendview = (USHORT) tempsusp;
     
    771773      if (cnri.cRecords) {
    772774        sprintf(s, GetPString(IDS_NUMDRIVESTEXT), cnri.cRecords);
    773         if (pci && pci->pszFileName && *pci->pszFileName) {
     775        if (pci && (INT) pci != -1 && pci->pszFileName && *pci->pszFileName) {
    774776          if (!(driveflags[toupper(*pci->pszFileName) - 'A'] &
    775777                DRIVE_REMOVABLE) ||
     
    18271829                     driveserial[toupper(*pci->pszFileName) - 'A'] !=
    18281830                     volser.serial)) {
    1829                   if (Flesh(hwnd, pci) &&
    1830                       SHORT2FROMMP(mp1) == CN_EXPANDTREE &&
    1831                       !dcd->suspendview && fTopDir) {
     1831                  if (SHORT2FROMMP(mp1) == CN_EXPANDTREE && Flesh(hwnd, pci)
     1832                      &&!dcd->suspendview  && fTopDir) {
    18321833                    PostMsg(hwnd, UM_TOPDIR, MPFROMP(pci), MPVOID);
    18331834                    //DbgMsg(pszSrcFile, __LINE__, "UM_TOPDIR %p pci %p", hwnd, pci);
     
    19051906      INT x;
    19061907
    1907       DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     1908      DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
    19081909      DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    19091910      if (fFollowTree)
     
    19841985          if (!status) {
    19851986            if (!volser.serial || driveserial[x] != volser.serial) {
    1986               UnFlesh(hwnd, pciP);
    19871987              Flesh(hwnd, pciP);
    19881988              driveserial[x] = volser.serial;
     
    19921992                              MPFROMP(pciP),
    19931993                              MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    1994             if (!pciL)
    1995               Flesh(hwnd, pciP);
     1994            if (!pciL) {
     1995              Flesh(hwnd, pciP);
     1996            }
    19961997            if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
    19971998                strlen(pciP->pszFileName) < 4) {
     
    27902791              if (pci->flags & RECFLAGS_UNDERENV)
    27912792                break;
    2792               DosWaitEventSem(hevTreeCnrScanComplete, SEM_INDEFINITE_WAIT);
     2793              DosRequestMutexSem(hmtxScanning, SEM_INDEFINITE_WAIT);
    27932794              DosResetEventSem(hevTreeCnrScanComplete, &ulScanPostCnt);
    27942795              UnFlesh(hwnd, pci);
     
    28022803                else  if (strlen(pci->pszFileName) < 4) {
    28032804                  SelectDriveIcon(pci);
    2804                 }
    2805                 if ((fShowFSTypeInTree || fShowDriveLabelInTree) &&
    2806                     strlen(pci->pszFileName) < 4) {
    2807                   strcpy(szBuf, pci->pszFileName);
    2808                   strcat(szBuf, " [");
    2809                   strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
    2810                   strcat(szBuf, "]");
    2811                   pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
    2812                   pci->rc.pszIcon = pci->pszDisplayName;
    2813                 }
     2805                  if (fShowFSTypeInTree || fShowDriveLabelInTree) {
     2806                    strcpy(szBuf, pci->pszFileName);
     2807                    strcat(szBuf, " [");
     2808                    strcat(szBuf, fShowFSTypeInTree ? FileSystem : volser.volumelabel);
     2809                    strcat(szBuf, "]");
     2810                    pci->pszDisplayName = xstrdup(szBuf, pszSrcFile, __LINE__);
     2811                    pci->rc.pszIcon = pci->pszDisplayName;
     2812                  }
     2813                }
    28142814                WinSendMsg(hwnd,
    28152815                           CM_INVALIDATERECORD,
Note: See TracChangeset for help on using the changeset viewer.