I have to make thread safety for my MFC ActiveX graphics engine because Windows 7 allow an application to run with a messagebox waiting for the user and even allowing the messagebox to be in the background while the user continue to use the program and make new calls to the engine. Without thread safety, the engine crashes with access violation.
The following mutex code did absolutely nothing and I don't understand why.
Code:// Declared in public class data HANDLE EngineMutex; // Executed in the class constructor EngineMutex = CreateMutex(NULL,FALSE,"EngineAccess"); // Used in start and end of all interface calls #define START_CALL WaitForSingleObject(EngineMutex,INFINITE); #define END_CALL ReleaseMutex(EngineMutex);




Reply With Quote