On Thu, Oct 18, 2001 at 12:22:10AM +0200, Michael Marxmeier wrote:
After encountering timeout messages from RtlEnterCriticalSection i had a look at it.
Since interlocked_inc() should never return zero the following patch is likely necessary. I was unable to test this as now wine crashes with a segmentation fault (which also terminates gdb).
That is a sign that your patch is faulty.
Any number of threads can increase this counter, it only succeeds if the count is really 0 before the call. (0 meaning the critical section is completely unlocked).
If it is any other number, it is either a recursive enter or a different thread.
Ciao, Marcus
Michael
--- critsection.c.orig Wed Oct 17 23:24:13 2001 +++ critsection.c Thu Oct 18 00:04:32 2001 @@ -233,7 +233,7 @@ */ NTSTATUS WINAPI RtlEnterCriticalSection( RTL_CRITICAL_SECTION *crit ) {
- if (interlocked_inc( &crit->LockCount ))
- if (interlocked_inc( &crit->LockCount ) != 1) { if (crit->OwningThread == GetCurrentThreadId()) {
Marcus Meissner wrote:
On Thu, Oct 18, 2001 at 12:22:10AM +0200, Michael Marxmeier wrote:
After encountering timeout messages from RtlEnterCriticalSection i had a look at it.
Since interlocked_inc() should never return zero the following patch is likely necessary. I was unable to test this as now wine crashes with a segmentation fault (which also terminates gdb).
That is a sign that your patch is faulty.
Yep, looks you're right. The lock count is initialied to -1 so the code is correct. Seems the critical sections in ole32 do not become initialized so the lock count is zero ...
Ciao, Marcus
Thanks for your correction.
Michael
Michael Marxmeier wrote:
Seems the critical sections in ole32 do not become initialized so the lock count is zero ...
Found it ...
Seems COMPOBJ_InitProcess() in dlls/ole32/compobj.c never gets called so the csRegisteredClassList critical section is uninitialized. After making sure the critical section gets intialized it works as expected.
As far as i can see this should get called from OLE32_DllEntryPoint() in dlls/ole32/ole32_main.c when the DLL is loaded. No idea why it does not and where to look next ...
Any clues to share?
Thanks Michael