Changeset 1570 for trunk/dll/makelist.c


Ignore:
Timestamp:
Jun 13, 2011, 12:09:19 AM (14 years ago)
Author:
Gregg Young
Message:

Added IdleIfNeeded to place load and free loops to idle priority when dealing with large numbers of items. Used SleepIfNeeded more places for a similar purpose.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/dll/makelist.c

    r1210 r1570  
    1616  29 Feb 08 GKY Use xfree where appropriate
    1717  17 Jul 08 SHL Add SetListOwner for Fortify support
     18  12 Jun 11 GKY Added IdleIfNeeded to the freelist loop to improve system
     19                responsiveness when freeing lists with large numbers of items
    1820
    1921***********************************************************************/
     
    3638#include "wrappers.h"                   // xfree
    3739#include "fortify.h"                    // 06 May 08 SHL
     40#include "tmrsvcs.h"                    // ITIMER_DESC
    3841
    3942static PSZ pszSrcFile = __FILE__;
     
    8588{
    8689  UINT x;
    87 
     90  ITIMER_DESC itdSleep = { 0 };         
     91           
    8892  if (list) {
     93     InitITimer(&itdSleep, 500);
    8994    for (x = 0; list[x]; x++) {
    9095#ifdef __DEBUG_ALLOC__
     
    9297#endif
    9398      free(list[x]);
     99      if (!IdleIfNeeded(&itdSleep, 30)) {
     100        for (x = x + 1; list[x]; x++) {
     101          free(list[x]);
     102        }
     103        break;
     104      }
    94105    }
    95106#ifdef __DEBUG_ALLOC__
     
    97108#endif
    98109    free(list);
    99   }
    100   DosPostEventSem(CompactSem);
     110    priority_normal();
     111    DosPostEventSem(CompactSem);
     112  }
    101113}
    102114
Note: See TracChangeset for help on using the changeset viewer.