Leaked source code of windows server 2003
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
902 B

  1. // Copyright (c) 2002 Microsoft Corporation
  2. //
  3. // File: init.h
  4. //
  5. // Synopsis: Declares an initialization guard
  6. // to ensure that all resources are freed
  7. //
  8. // History: 03/26/2002 JeffJon Created
  9. #ifndef __CYSINIT_H
  10. #define __CYSINIT_H
  11. // For an explanation of the initialization guard thing, see Meyers,
  12. // Scott. "Effective C++ pp. 178-182 Addison-Wesley 1992. Basically, it
  13. // guarantees that this library is properly initialized before any code
  14. // that uses it is called.
  15. class CYSInitializationGuard
  16. {
  17. public:
  18. CYSInitializationGuard();
  19. ~CYSInitializationGuard();
  20. private:
  21. static unsigned counter;
  22. // not defined
  23. CYSInitializationGuard(const CYSInitializationGuard&);
  24. const CYSInitializationGuard& operator=(const CYSInitializationGuard&);
  25. };
  26. static CYSInitializationGuard cysguard;
  27. #endif // __CYSINIT_H