Chapter 5: Apartments

STDMETHODIMP CMyClass::MethodX(void) {
  EnterCriticalSection(&m_cs);
  if (TryToPerformX() == false)
    return E_UNEXPECTED;
  LeaveCriticalSection(&m_cs);
  return S_OK;
}
Anonymous, 1996

The previous chapter discussed the fundamentals of COM identity and formally defined what distinguishes COM objects from random memory. The rules of IUnknown were presented, in addition to techniques for leveraging these rules to afford the object implementor maximum flexibility. This chapter refines the definition of COM identity to take into account basic operating system primitives (e.g., threads, processes) and distributed access. This marriage of system primitives and distribution forms the basis for the COM remoting architecture.

© 1998 by Addison Wesley Longman, Inc. All rights reserved.