What is the relation ship between CRITICAL_SECTION and CCriticalSection?

Yes the MFC CCriticalSection section is just a wrapper around a Win32 CRITICAL_SECTION.

Yes the MFC CCriticalSection section is just a wrapper around a Win32 CRITICAL_SECTION. This goes for pretty much all of MFC, its a huge set of wrapper classes around standard Win32 functionality. As to your code example, yes the use of a critical section in that context is meaningless.

What a critical section does is akin to a named mutex, it ensures that a resource can only be accessed by a single thread at a time. Proper use of a critical section would be as an object accessible by multiple threads, then when using a resource which cannot be used by more than one thread at a time: MyGlobalCS.Lock(); // Do important work on resource MyGlobalCS.Unlock(); Also note that if its hard to get the critical section into a shared location you can use a named mutex instead.

True, and it's worth noting that the one really useful thing it could provide, RAII, it doesn't. If you're using C++ and MFC, you really need to consider using boost instead. – Tim Sylvester Aug 27 '09 at 3:30 I would say 'alongside' not 'instead', boost certainly doesn't replace the majority of what MFC is targeted at, that being GUIs.

– DeusAduro Aug 27 '09 at 7:24.

I cant really gove you an answer,but what I can give you is a way to a solution, that is you have to find the anglde that you relate to or peaks your interest. A good paper is one that people get drawn into because it reaches them ln some way.As for me WW11 to me, I think of the holocaust and the effect it had on the survivors, their families and those who stood by and did nothing until it was too late.

Related Questions