ATL Internals 2ed复习.chapter 4.Thread
来源:互联网 发布:linux telnet root 编辑:程序博客网 时间:2024/06/06 04:05
Instance Data Synchronization
CComCriticalSection:使用Init()生成,Term()销毁
CComAutoCriticalSection:使用构造函数生成,析构函数销毁
CComSafeDeleteCriticalSection:Init()生成,析构函数销毁
CComAutoDeleteCriticalSection:未定义Term(),用于静态、全局
CComFakeCriticalSection:Init(),Term(),Lock(),Unlock()均为空操作
上述类均需要Lock()锁定,Unlock解锁】
template< class TLock > class CComCritSecLock:构造函数锁定,析构函数解锁
Threading Model Support
ATL提供了3种线程模型:
class CcomSingleThreadModel { public: static ULONG WINAPI Increment(LPLONG p) {return ++(*p);} static ULONG WINAPI Decrement(LPLONG p) {return (*p);} typedef CComFakeCriticalSection AutoCriticalSection; typedef CComFakeCriticalSection AutoDeleteCriticalSection; typedef CComFakeCriticalSection CriticalSection; typedef CComSingleThreadModel ThreadModelNoCS; }; class CcomMultiThreadModel { public: static ULONG WINAPI Increment(LPLONG p) {return InterlockedIncrement(p);} static ULONG WINAPI Decrement(LPLONG p) {return InterlockedDecrement(p);} typedef CComAutoCriticalSection AutoCriticalSection; typedef CComAutoDeleteCriticalSection AutoDeleteCriticalSection; typedef CComCriticalSection CriticalSection; typedef CComMultiThreadModelNoCS ThreadModelNoCS; }; class CcomMultiThreadModelNoCS { public: static ULONG WINAPI Increment(LPLONG p) {return InterlockedIncrement(p);} static ULONG WINAPI Decrement(LPLONG p) {return InterlockedDecrement(p);} typedef CComFakeCriticalSection AutoCriticalSection; typedef CComFakeCriticalSection AutoDeleteCriticalSection; typedef CComFakeCriticalSection CriticalSection; typedef CComMultiThreadModelNoCS ThreadModelNoCS; };
CcomSingleThreadModel
CComMultiThreadModel
CComMultiThreadModelNoCS
TM::Increment
++
Interlocked-Increment
Interlocked-Increment
TM::Decrement
Interlocked-Decrement
Interlocked-Decrement
TM::AutoCriticalSection::Lock
(Nothing)
EnterCritical-Section
(Nothing)
TM::AutoCriticalSection::Unlock
(Nothing)
LeaveCritical-Section
(Nothing)
- ATL Internals 2ed复习.chapter 4.Thread
- ATL Internals 2ed复习.chapter 2
- ATL Internals 2ed复习.chapter 4.IUnknown
- ATL Internals 2ed复习.chapter 4.Creators
- ATL Internals 2ed复习.chapter 4.Debugging
- ATL Internals 2ed复习.chapter 3.ATL Memory Managers
- ATL Internals 2ed复习.chapter 7.ATL Persistence implements
- ATL Internals 2ed复习.chapter 3.CComVariant
- ATL Internals 2ed复习.chapter 3.SAFEARRAY
- ATL Internals 2ed复习.chapter 3.CComSafeArray
- ATL Internals 2ed复习.chapter 3.CComPtr CComQIPtr
- ATL Internals 2ed复习.chapter 3.CComGITPtr
- ATL Internals 2ed复习.chapter 3.CAutoPtr
- ATL Internals 2ed复习.chapter 5.COM Server review
- ATL Internals 2ed复习.chapter 5.Object Map
- ATL Internals 2ed复习.chapter 5.CAtlModule
- ATL Internals 2ed复习.chapter 6.Table driven QueryInterface
- ATL Internals 2ed复习.chapter 6.interface map tricks
- hdu 4288 Coder
- PS CS4抽出滤镜抠图小技巧
- BigBlueButton mysql修改为postgresql or oracle
- 真彩色制式下IplImage转成CBitmap格式
- 作业、进程、线程、管程、管道概念梳理
- ATL Internals 2ed复习.chapter 4.Thread
- extern "C"
- 为上班族设计的英语学习方法
- 贴图的支持及设置:关于贴图分辨率的支持及设置的用户指南
- hdu 2844(背包)
- Java关于继承中的转型及其内存分配
- 学好英语必不可少:语法与语感
- UE3 贴图支持及设置
- 什么是显卡,显卡的主要部件和主要技术规格有哪些