home *** CD-ROM | disk | FTP | other *** search
/ Tricks of the Windows Gam…ming Gurus (2nd Edition) / Disc2.iso / vc98 / mfc / include / afxmt.inl < prev    next >
Text File  |  1998-06-16  |  2KB  |  51 lines

  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.  
  11. // Inlines for AFXMT.H
  12.  
  13. #ifdef _AFXMT_INLINE
  14.  
  15. _AFXMT_INLINE CSyncObject::operator HANDLE() const
  16.     { return m_hObject;}
  17.  
  18. _AFXMT_INLINE BOOL CSemaphore::Unlock()
  19.     { return Unlock(1, NULL); }
  20.  
  21. _AFXMT_INLINE BOOL CEvent::SetEvent()
  22.     { ASSERT(m_hObject != NULL); return ::SetEvent(m_hObject); }
  23. _AFXMT_INLINE BOOL CEvent::PulseEvent()
  24.     { ASSERT(m_hObject != NULL); return ::PulseEvent(m_hObject); }
  25. _AFXMT_INLINE BOOL CEvent::ResetEvent()
  26.     { ASSERT(m_hObject != NULL); return ::ResetEvent(m_hObject); }
  27.  
  28. _AFXMT_INLINE CSingleLock::~CSingleLock()
  29.     { Unlock(); }
  30. _AFXMT_INLINE BOOL CSingleLock::IsLocked()
  31.     { return m_bAcquired; }
  32.  
  33. _AFXMT_INLINE BOOL CMultiLock::IsLocked(DWORD dwObject)
  34.     { ASSERT(dwObject >= 0 && dwObject < m_dwCount);
  35.          return m_bLockedArray[dwObject]; }
  36.  
  37. _AFXMT_INLINE CCriticalSection::CCriticalSection() : CSyncObject(NULL)
  38.     { ::InitializeCriticalSection(&m_sect); }
  39. _AFXMT_INLINE CCriticalSection::operator CRITICAL_SECTION*()
  40.     { return (CRITICAL_SECTION*) &m_sect; }
  41. _AFXMT_INLINE CCriticalSection::~CCriticalSection()
  42.     { ::DeleteCriticalSection(&m_sect); }
  43. _AFXMT_INLINE BOOL CCriticalSection::Lock()
  44.     { ::EnterCriticalSection(&m_sect); return TRUE; }
  45. _AFXMT_INLINE BOOL CCriticalSection::Lock(DWORD /* dwTimeout */)
  46.     { return Lock(); }
  47. _AFXMT_INLINE BOOL CCriticalSection::Unlock()
  48.     { ::LeaveCriticalSection(&m_sect); return TRUE; }
  49.  
  50. #endif //_AFXMT_INLINE
  51.