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.

24 lines
469 B

  1. #include "PassportLock.hpp"
  2. PassportLock::PassportLock(DWORD dwSpinCount)
  3. {
  4. if(0 ==InitializeCriticalSectionAndSpinCount(&mLock, dwSpinCount))
  5. {
  6. throw(GetLastError()); // it's safe to throw, no issue about partial construction
  7. }
  8. }
  9. void PassportLock::acquire()
  10. {
  11. EnterCriticalSection(&mLock);
  12. }
  13. void PassportLock::release()
  14. {
  15. LeaveCriticalSection(&mLock);
  16. }
  17. PassportLock::~PassportLock()
  18. {
  19. DeleteCriticalSection(&mLock);
  20. }