Stefan Dösinger wrote:
@@ -851,6 +853,13 @@ DllMain(HINSTANCE hInstDLL,
/* Initialize the ddraw object list critical section unconditionally
* Even if the app doesn't use multithreaded ddraw objects it can still
* use multiple ddraw objects in multiple threads
* Well, initialize it only once
*/
if(counter == 0) InitializeCriticalSection(&listCrit);
Isn't "counter" redundant? When DllMain is called, the loader lock is held. Furthermore, DllMain( ... DLL_PROCESS_ATTACH) is only called once per process, so counter should only ever be 1 after a DLL_PROCESS_ATTACH and 0 after a DETACH.
Mike
Am Freitag 06 Oktober 2006 08:42 schrieben Sie:
Stefan Dösinger wrote:
@@ -851,6 +853,13 @@ DllMain(HINSTANCE hInstDLL,
/* Initialize the ddraw object list critical section
unconditionally + * Even if the app doesn't use multithreaded ddraw objects it can still + * use multiple ddraw objects in multiple threads
* Well, initialize it only once
*/
if(counter == 0) InitializeCriticalSection(&listCrit);
Isn't "counter" redundant? When DllMain is called, the loader lock is held. Furthermore, DllMain( ... DLL_PROCESS_ATTACH) is only called once per process, so counter should only ever be 1 after a DLL_PROCESS_ATTACH and 0 after a DETACH.
Yes, I think it is redundant, as long as the ddraw.dll globals can't be shared accross processes. afair it is a leftover of when I used DLL_THREAD_ATTACH instead of PROCESS_ATTACH.
The counter is used at some other places too and is independent of this patch, so I think it is best to send another patch removing the counter.