Changeset 1871 for trunk/dll/dirsize.c


Ignore:
Timestamp:
Sep 21, 2015, 12:57:02 AM (10 years ago)
Author:
Gregg Young
Message:

Create CollapseAll and modify ExpandAll to reduce code overhead both to try and speed drive expansion. Change ExpandAll to allow it to loop in UM_EXPAND until until drive is completely expanded. Changes were need to work with Flesh, Stubby and UnFlesh being moved to a thread. Add code for Flesh to skip the directory entry added by Stubby (eliminate use of NULL/Nullstr pszFileNames by Stubby). Add code in Stubby to insert a complete container item. Add a flag to indicate when a directory needed to be Fleshed. Get expand and switch code to work with Flesh, UnFlesh and Stubby running on a thread. Loop and idle ExpandAll; Move tree expand to a thread; Have ShowTreeRec wait for the Flesh thread. Add a correction factor so directories don't get placed above the top of the tree container when a large drive has been expanded. Debug is mostly still in but all turned off.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/dirsize.c

    r1673 r1871  
    77
    88  Copyright (c) 1993-98 M. Kimes
    9   Copyright (c) 2001, 2010 Steven H. Levine
     9  Copyright (c) 2001, 2015 Steven H. Levine
    1010
    1111  16 Oct 02 SHL Handle large partitions
     
    5656                by temp file creation failures.
    5757  12 Jun 11 GKY Added SleepIfNeeded in the container fill loop
     58  20 Sep 15 GKY Move directory expansion to a thread. Split ExpandAll into ExpandAll and CollapseAll
     59                to try to speed proccessing else where.
    5860
    5961***********************************************************************/
     
    109111typedef struct
    110112{
     113  HWND hwndCnr;
     114  PCNRITEM pci;
     115} EXPANDSIZE;
     116
     117typedef struct
     118{
    111119  CHAR szDirName[CCHMAXPATH];
    112120  CHAR chStopFlag;
     
    497505  PostMsg(WinQueryWindow(hwndCnr, QW_PARENT),
    498506          UM_CONTAINER_FILLED, MPVOID, MPVOID);
     507# ifdef FORTIFY
     508  Fortify_LeaveScope();
     509#  endif
     510}
     511
     512static VOID ExpandCnrThread(VOID *args)
     513{
     514  HAB hab;
     515  HMQ hmq;
     516  INT x = 0;
     517  EXPANDSIZE *expandsize = (EXPANDSIZE *)args;
     518
     519  if (!expandsize) {
     520    Runtime_Error(pszSrcFile, __LINE__, NULL);
     521    return;
     522  }
     523# ifdef FORTIFY
     524  Fortify_EnterScope();
     525  Fortify_BecomeOwner(expandsize);              // We free dirsize
     526#  endif
     527
     528  DosError(FERR_DISABLEHARDERR);
     529
     530  priority_idle();
     531  hab = WinInitialize(0);
     532  if (hab) {
     533    hmq = WinCreateMsgQueue(hab, 0);
     534    if (hmq) {
     535      WinCancelShutdown(hmq, TRUE);
     536      ExpandAll(expandsize->hwndCnr, x, expandsize->pci);
     537      WinDestroyMsgQueue(hmq);
     538    }
     539    WinTerminate(hab);
     540  }
     541
     542  xfree(expandsize, pszSrcFile, __LINE__);
    499543# ifdef FORTIFY
    500544  Fortify_LeaveScope();
     
    10101054          WinEnableWindow(WinWindowFromID(hwnd, DSZ_PRINT), FALSE);
    10111055          WinEnableWindow(WinWindowFromID(hwnd, DID_CANCEL), FALSE);
    1012           // fixme to use thread - too slow on large trees
    1013           ExpandAll(WinWindowFromID(hwnd, DSZ_CNR),
    1014                     (SHORT1FROMMP(mp1) == DSZ_EXPAND), pci);
     1056          if (SHORT1FROMMP(mp1) == DSZ_EXPAND) {
     1057            EXPANDSIZE *expandsize;
     1058
     1059            expandsize = xmalloc(sizeof(EXPANDSIZE), pszSrcFile, __LINE__);
     1060            if (expandsize) {
     1061
     1062            expandsize->pci = pci;
     1063            expandsize->hwndCnr = WinWindowFromID(hwnd, DSZ_CNR);
     1064            if (xbeginthread(ExpandCnrThread,
     1065                             122880 * 5,
     1066                             expandsize,
     1067                             pszSrcFile,
     1068                             __LINE__) == -1)
     1069              xfree(expandsize, pszSrcFile, __LINE__);
     1070            }
     1071          }
     1072          else
     1073            CollapseAll(WinWindowFromID(hwnd, DSZ_CNR), pci);
    10151074          WinEnableWindow(WinWindowFromID(hwnd, DID_OK), TRUE);
    10161075          WinEnableWindow(WinWindowFromID(hwnd, IDM_HELP), TRUE);
Note: See TracChangeset for help on using the changeset viewer.