到底用不用CSingleLock和CMultiLock ?
力为
博客专家认证 2005-09-27 11:46:57 MSDN这样说的:
In order to use the synchronization classes CSemaphore, CMutex, CCriticalSection, and CEvent, you must create either a CSingleLock or CMultiLock object to wait on and release the synchronization object.
但又这样说的:
Alternatively, you can create a CSemaphore object stand-alone, and access it explicitly before attempting to access the controlled resource. This method, while clearer to someone reading your source code, is more prone to error.
前面说必须用CSingleLock 或 CMultiLock ,后面说可以不用。
但到底是用还是不用呢?
不用会容易发生什么错误呢?