Possible duplicate:
DLL thread security
Hi
Im writes a DLL file to MS VS C ++ express, which is simultaneously loaded into several client applications, it uses shared memory with other instances of the loaded DLL. Suppose a DLL looks something like this:
#include stdafx.h
#pragma data_seg (".TEST")
#pragma data_seg ()
#pragma comment(linker, "/section:.TEST,RWS")
_DLLAPI void __stdcall doCalc()
{
}
If it doCalcis called simultaneously from two or more clients, the system will fail. How can I create a mutex that stops other calls if the function is already called? Please give an example, since I spent the last two hours trying to find a decent one on the Internet;)
Thanks in advance.
source
share