RtlEnterCriticalSection
Marcus Meissner
marcus at jet.franken.de
Thu Oct 18 01:13:58 CDT 2001
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())
> {
>
>
More information about the wine-devel
mailing list