P.S. Problem with X11 driver

Andreas Mohr andi at rhlx01.fht-esslingen.de
Sun Oct 20 08:45:06 CDT 2002

On Sun, Oct 20, 2002 at 08:27:00AM +0200, Till Mossakowski wrote:
> P.S.
> I should be more precise: P1 and P2 are different Wine *threads*
> (and Linux processes).
> Shouldn't all threads use the *same* X11 lock, such that
> only one thread at a time can have the X11 lock?
Well, err... yes.
That's exactly what we do.
We clone() (on Linux) the current Wine process for a new thread
(thus we get *two* Wine processes).
And due to clone()ing, the second process shares the process environment
of the first process (almost) completely.
Thus the X11 lock variable is the same.
(otherwise a "lock" wouldn't be a "lock" and wouldn't make a whole lot
of sense ;-))

OK, talking about deadlocks...

Normally you've got a scarce resource (here: X11 processing) that
you need to access exclusively.
Thus you create a lock.

First thread enters lock. Lock held.
Second thread enters lock. No Go, first thread holding lock.
First thread finished its work and leaves lock.
Second thread is now able to enter the lock.
First thread tries to reenter the lock. No Go, second thread holding lock.
Second thread leaving lock.

No problems at all so far.

But the big issue with such a scenario is: what happens if the
first thread gets stuck and can't release the lock ?
Bad luck ;-)
(since EVERYTHING will hit the wall)

How can this happen ?

Well, either the first thread gets caught in a loop forever,
or the first thread is trying to enter a different lock which the *second*
thread already holds (and the second thread can't release it since it's
already stuck waiting on the first thread's lock) *or* the first thread
fails to release a lock (missing unlock !).

What we need is backtraces of *all* wine processes that are involved
in the deadlock.

gdb wine
attach <Wine PID>
attach <next Wine PID>

That way we'll hopefully be able to figure out why the processes are getting

Andreas Mohr                        Stauferstr. 6, D-71272 Renningen, Germany
Tel. +49 7159 800604                http://mohr.de.tt

More information about the wine-devel mailing list