DDraw: Protect the ddraw object list

Stefan Dösinger stefandoesinger at gmx.at
Fri Oct 6 03:48:07 CDT 2006


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.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
Url : http://www.winehq.org/pipermail/wine-devel/attachments/20061006/18018562/attachment.pgp


More information about the wine-devel mailing list