Changeset 1838 for trunk/dll


Ignore:
Timestamp:
Aug 3, 2015, 12:14:21 AM (10 years ago)
Author:
Gregg Young
Message:

Serialize local hard drive scanning to reduce drive thrashing continue to scan all other drive types in separate threads. Ticket [561] Remove unneed SubbyScan code and improve suppression of blank lines and duplicate subdirectory name caused by running Stubby in worker threads.

Location:
trunk/dll
Files:
6 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dircnrs.c

    r1836 r1838  
    9090  02 May 15 GKY Changes to allow a JAVA executable object to be created using "Real object"
    9191                menu item on a jar file.
     92  02 Aug 15 GKY Remove unneed SubbyScan code and improve suppression of blank lines and
     93                duplicate subdirectory name caused by running Stubby in worker threads.
    9294
    9395***********************************************************************/
     
    832834                       MPVOID, MPFROM2SHORT(CMA_FIRST, CMA_ITEMORDER));
    833835      while (pci && (INT) pci != -1) {
     836        if (!pci->pszFileName || !strcmp(pci->pszFileName, NullStr)) {
     837          Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
     838          return 0;
     839        }
    834840        if (pci->attrFile & FILE_DIRECTORY) {
    835841          pciC = WinSendMsg(dcd->hwndCnr,
     
    837843                            MPFROMP(pci),
    838844                            MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    839           if (!pciC) {
    840             Stubby(dcd->hwndCnr, pci);
    841           }
     845          if (!pciC) {
     846            Stubby(dcd->hwndCnr, pci);
     847          }
    842848        }
    843849        pci = WinSendMsg(dcd->hwndCnr,
     
    895901        if (fSwitchTreeOnDirChg) {
    896902          // Keep drive tree in sync with directory container
    897           PSZ pszTempDir;
    898           while (fInitialDriveScan) {
    899             DosSleep(100);                      // Allow to complete
    900           }
     903          PSZ pszTempDir;
     904          while (fInitialDriveScan)
     905            DosSleep(10);                       // Allow to complete
     906          DosSleep(50);
    901907          pszTempDir = xstrdup(dcd->directory, pszSrcFile, __LINE__);
    902908          if (pszTempDir) {
     
    15631569      WinSendMsg(hwnd,
    15641570                 CM_QUERYCNRINFO,
    1565                 MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
     1571                MPFROMP(&cnri), MPFROMLONG(sizeof(CNRINFO)));
    15661572      cnri.pSortRecord = (PVOID) SortDirCnr;
    15671573      WinSendMsg(hwnd,
     
    15901596        cnri.flWindowAttr &= (~(CV_TREE | CV_ICON | CV_DETAIL | CV_TEXT));
    15911597        cnri.flWindowAttr |= (CV_NAME | CA_DETAILSVIEWTITLES | CV_MINI |
    1592                               CV_FLOW);
     1598                              CV_FLOW);
    15931599        cnri.pSortRecord = (PVOID) SortDirCnr;
    15941600
     
    21222128            dcd->sortFlags |= SORT_REVERSE;
    21232129          break;
    2124         }
     2130        }
    21252131        WinSendMsg(hwnd, CM_SORTRECORD, MPFROMP(SortDirCnr),
    21262132                   MPFROMLONG(dcd->sortFlags));
  • trunk/dll/filldir.c

    r1836 r1838  
    109109  14 Jun 15 GKY Changes to prevent trap in Filter, heap corruption and traps associated with it
    110110  19 Jun 15 JBS Ticket 514: Double free fix (which also fixes a memory leak)
     111  02 Aug 15 GKY Serialize local hard drive scanning to reduce drive thrashing continue to scan
     112                all other drive types in separate threads.
     113  02 Aug 15 GKY Remove unneed SubbyScan code and improve suppression of blank lines and
     114                duplicate subdirectory name caused by running Stubby in worker threads.
    111115
    112116***********************************************************************/
     
    263267          ULONG flags = driveflags[toupper(*StubbyScan->pci->pszFileName) - 'A'];
    264268
    265           if ((fRScanLocal && ~flags & DRIVE_REMOTE && ~flags & DRIVE_VIRTUAL) ||
     269          if ((fRScanLocal && flags & DRIVE_LOCALHD ) ||
    266270               (fRScanRemote && flags & DRIVE_REMOTE) ||
    267271               (fRScanVirtual && flags & DRIVE_VIRTUAL)) {
     
    276280          else {
    277281            Stubby(StubbyScan->hwndCnr, StubbyScan->pci);
    278           }
     282          }
     283          if (flags & DRIVE_LOCALHD)
     284            DosReleaseMutexSem(hmtxScanningLocalHD);
    279285        }
    280286        WinDestroyMsgQueue(hmq);
     
    289295  if (ProcessDirCount >= FixedVolume) {
    290296    DosReleaseMutexSem(hmtxScanning);
    291     DosPostEventSem(hevTreeCnrScanComplete);
    292     if (fInitialDriveScan && fSwitchTreeOnDirChg && hwndTree && fSaveState && pszFocusDir) {
    293        // Keep drive tree in sync with directory container
    294       if (!PostMsg(hwndTree, UM_SHOWME, MPFROMP(pszFocusDir), MPVOID))
    295         free(pszFocusDir);
    296     }
     297    DosPostEventSem(hevTreeCnrScanComplete);   
    297298    ProcessDirCount = 0;
    298299    FixedVolume = 0;
     
    981982              (!filestoo && ~pffbFile->attrFile & FILE_DIRECTORY) ||
    982983              (pffbFile->attrFile & FILE_DIRECTORY &&
    983                pffbFile->achName[0] == '.' &&
     984               !pffbFile->achName[0] || pffbFile->achName[0] == '.' &&
    984985               (!pffbFile->achName[1] ||
    985986                (pffbFile->achName[1] == '.' && !pffbFile->achName[2])))) {
     
    10211022                pffbFile = papffbSelected[x];
    10221023                ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    1023                                                pffbFile, partial, dcd);
     1024                                               pffbFile, partial, dcd);
    10241025                pci = (PCNRITEM) pci->rc.preccNextRecord;
    10251026                ullTotalBytes += ullBytes;
     
    11431144          }
    11441145          ullBytes = FillInRecordFromFFB(hwndCnr, pci, pszFileSpec,
    1145                                         pffbFile, partial, dcd);
     1146                                        pffbFile, partial, dcd);
    11461147          pci = (PCNRITEM) pci->rc.preccNextRecord;
    11471148          ullTotalBytes += ullBytes;
     
    12511252                     MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    12521253    while (pci && (INT)pci != -1) {
     1254      if (!pci->pszFileName || !strcmp(pci->pszFileName, NullStr)) {
     1255        Runtime_Error(pszSrcFile, __LINE__, "pci->pszFileName NULL for %p", pci);
     1256        return;
     1257      }
    12531258      if ((pci->attrFile & FILE_DIRECTORY))
    1254         Stubby(hwndCnr, pci);
     1259        Stubby(hwndCnr, pci);
    12551260      pci = WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
    1256                        MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
     1261                       MPFROM2SHORT(CMA_NEXT, CMA_ITEMORDER));
    12571262    }
    12581263  }
     
    16811686          if (~flags & DRIVE_INVALID &&
    16821687              ~flags & DRIVE_NOPRESCAN && (!fNoRemovableScan || ~flags & DRIVE_REMOVABLE)) {
    1683             // DbgMsg(pszSrcFile, __LINE__, "Begin Thread %s", pci->pszFileName);
    1684             if (xbeginthread(StubbyScanThread,
    1685                              65536,
    1686                              stubbyScan,
    1687                              pszSrcFile, __LINE__) == -1)
    1688               xfree(stubbyScan, pszSrcFile, __LINE__);
     1688            // DbgMsg(pszSrcFile, __LINE__, "Begin Thread %s", pci->pszFileName);
     1689            if (flags & DRIVE_LOCALHD) {
     1690              DosRequestMutexSem(hmtxScanningLocalHD, SEM_INDEFINITE_WAIT );
     1691              if (xbeginthread(StubbyScanThread,
     1692                               65536,
     1693                               stubbyScan,
     1694                               pszSrcFile, __LINE__) == -1) {
     1695                DosReleaseMutexSem(hmtxScanningLocalHD);
     1696                xfree(stubbyScan, pszSrcFile, __LINE__);
     1697              }
     1698            }
     1699            else {
     1700              if (xbeginthread(StubbyScanThread,
     1701                               65536,
     1702                               stubbyScan,
     1703                               pszSrcFile, __LINE__) == -1)
     1704                xfree(stubbyScan, pszSrcFile, __LINE__);
     1705            }
    16891706
    16901707          } // if drive needs to be scanned
  • trunk/dll/init.c

    r1830 r1838  
    131131  30 Aug 14 GKY Add semaphore hmtxFiltering to prevent freeing dcd while filtering. Prevents
    132132                a trap when FM2 is shutdown while directory containers are still populating
     133  02 Aug 15 GKY Serialize local hard drive scanning to reduce drive thrashing continue to scan
     134                all other drive types in separate threads.
    133135
    134136***********************************************************************/
     
    233235HMTX hmtxFM2Globals;
    234236HMTX hmtxScanning;
     237HMTX hmtxScanningLocalHD;
     238HMTX hmtxScanningLocal;
    235239HMTX hmtxFiltering;
    236240HEV  hevTreeCnrScanComplete;
     
    11651169  if (DosCreateMutexSem(NULL, &hmtxScanning, 0L, TRUE))
    11661170    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     1171              PCSZ_DOSCREATEMUTEXSEM);
     1172  if (DosCreateMutexSem(NULL, &hmtxScanningLocalHD, 0L, FALSE))
     1173    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
     1174              PCSZ_DOSCREATEMUTEXSEM);
     1175    if (DosCreateMutexSem(NULL, &hmtxScanningLocal, 0L, FALSE))
     1176    Dos_Error(MB_CANCEL, rc, HWND_DESKTOP, pszSrcFile, __LINE__,
    11671177              PCSZ_DOSCREATEMUTEXSEM);
    11681178  if (DosCreateMutexSem(NULL, &hmtxFM2Delete, 0L, FALSE))
  • trunk/dll/init.h

    r1786 r1838  
    4141  30 Aug 14 GKY Add semaphore hmtxFiltering to prevent freeing dcd while filtering. Prevents
    4242                a trap when FM2 is shutdown while directory containers are still populating
     43  02 Aug 15 GKY Serialize local hard drive scanning to reduce drive thrashing continue to scan
     44                all other drive types in separate threads.
    4345
    4446***********************************************************************/
     
    238240extern HMTX hmtxFM2Delete;
    239241extern HMTX hmtxScanning;
     242extern HMTX hmtxScanningLocalHD;
     243extern HMTX hmtxScanningLocal;
    240244extern HMTX hmtxFiltering;
    241245extern HEV  hevTreeCnrScanComplete;
  • trunk/dll/mainwnd.c

    r1778 r1838  
    115115  30 Dec 12 GKY Enhance traget directory drop to give the option of changing the directory or carrying out an
    116116                operation to the current target; Added an error message for target = None;
     117  02 Aug 15 GKY Remove unneed SubbyScan code and improve suppression of blank lines and
     118                duplicate subdirectory name caused by running Stubby in worker threads.
    117119
    118120***********************************************************************/
     
    35533555            continue;
    35543556          }
    3555           if (x == 0 && fSwitchTreeOnDirChg)
    3556             pszFocusDir = xstrdup(szDir, pszSrcFile, __LINE__);
    35573557          LoadDetailsSwitches(szKeyBase, &localdcd.ds, TRUE);
    35583558          hwndDir = (HWND) WinSendMsg(hwndClient,
  • trunk/dll/select.c

    r1812 r1838  
    3232  31 May 11 SHL Ensure mask->pszMasks[1] initialize to NULL if not used
    3333  13 Jun 15 GKY Fixed compare selection replaced pszFileNames with pszDisplayNames
     34  02 Aug 15 GKY Remove unneed SubbyScan code and improve suppression of blank lines and
     35                duplicate subdirectory name caused by running Stubby in worker threads.
    3436
    3537***********************************************************************/
     
    6365#include "stristr.h"                    // findstring
    6466#include "fortify.h"
     67#if 0
     68#define  __PMPRINTF__
     69#include "PMPRINTF.H"
     70#endif
    6571
    6672static PSZ pszSrcFile = __FILE__;
     
    572578    pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pciParent),
    573579                                MPFROM2SHORT(CMA_FIRSTCHILD, CMA_ITEMORDER));
    574     if (pci)
    575       DosSleep(0);
    576     while (pci && (INT)pci != -1) {
     580      while (pci && (INT)pci != -1) {
    577581      ExpandAll(hwndCnr, expand, pci);
    578582      pci = (PCNRITEM) WinSendMsg(hwndCnr, CM_QUERYRECORD, MPFROMP(pci),
Note: See TracChangeset for help on using the changeset viewer.