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.

50 lines
1.8 KiB

  1. // This is a part of the Microsoft Foundation Classes C++ library.
  2. // Copyright (C) 1992-1998 Microsoft Corporation
  3. // All rights reserved.
  4. //
  5. // This source code is only intended as a supplement to the
  6. // Microsoft Foundation Classes Reference and related
  7. // electronic documentation provided with the library.
  8. // See these sources for detailed information regarding the
  9. // Microsoft Foundation Classes product.
  10. // Inlines for AFXMT.H
  11. #ifdef _AFXMT_INLINE
  12. _AFXMT_INLINE CSyncObject::operator HANDLE() const
  13. { return m_hObject;}
  14. _AFXMT_INLINE BOOL CSemaphore::Unlock()
  15. { return Unlock(1, NULL); }
  16. _AFXMT_INLINE BOOL CEvent::SetEvent()
  17. { ASSERT(m_hObject != NULL); return ::SetEvent(m_hObject); }
  18. _AFXMT_INLINE BOOL CEvent::PulseEvent()
  19. { ASSERT(m_hObject != NULL); return ::PulseEvent(m_hObject); }
  20. _AFXMT_INLINE BOOL CEvent::ResetEvent()
  21. { ASSERT(m_hObject != NULL); return ::ResetEvent(m_hObject); }
  22. _AFXMT_INLINE CSingleLock::~CSingleLock()
  23. { Unlock(); }
  24. _AFXMT_INLINE BOOL CSingleLock::IsLocked()
  25. { return m_bAcquired; }
  26. _AFXMT_INLINE BOOL CMultiLock::IsLocked(DWORD dwObject)
  27. { ASSERT(dwObject < m_dwCount);
  28. return m_bLockedArray[dwObject]; }
  29. _AFXMT_INLINE CCriticalSection::CCriticalSection() : CSyncObject(NULL)
  30. { ::InitializeCriticalSection(&m_sect); }
  31. _AFXMT_INLINE CCriticalSection::operator CRITICAL_SECTION*()
  32. { return (CRITICAL_SECTION*) &m_sect; }
  33. _AFXMT_INLINE CCriticalSection::~CCriticalSection()
  34. { ::DeleteCriticalSection(&m_sect); }
  35. _AFXMT_INLINE BOOL CCriticalSection::Lock()
  36. { ::EnterCriticalSection(&m_sect); return TRUE; }
  37. _AFXMT_INLINE BOOL CCriticalSection::Lock(DWORD /* dwTimeout */)
  38. { return Lock(); }
  39. _AFXMT_INLINE BOOL CCriticalSection::Unlock()
  40. { ::LeaveCriticalSection(&m_sect); return TRUE; }
  41. #endif //_AFXMT_INLINE