Source code of Windows XP (NT5)
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

37 lines
842 B

  1. #include <windows.h>
  2. #include <stdio.h>
  3. #include <wbemcomn.h>
  4. #include "filecach.h"
  5. #define A51_MAX_SLEEPS 1000
  6. #define A51_ONE_SLEEP 100
  7. long FlushOldCache(LPCWSTR wszRepDir)
  8. {
  9. long lRes;
  10. //
  11. // Instantiate the old staging file and flush it
  12. //
  13. a51converter::CFileCache OldCache;
  14. lRes = OldCache.Initialize(wszRepDir);
  15. if(lRes != ERROR_SUCCESS)
  16. return lRes;
  17. int n = 0;
  18. while(!OldCache.IsFullyFlushed() && n++ < A51_MAX_SLEEPS)
  19. Sleep(A51_ONE_SLEEP);
  20. if(!OldCache.IsFullyFlushed())
  21. {
  22. ERRORTRACE((LOG_WBEMCORE, "Upgrade waited for the old cache to flush "
  23. "for %d seconds, but with no success. Aborting "
  24. "upgrade\n", A51_MAX_SLEEPS * A51_ONE_SLEEP));
  25. return ERROR_TIMEOUT;
  26. }
  27. return ERROR_SUCCESS;
  28. }