user: [2/2] Pass hook handle to the destination thread. Call server to get hook information

Vitaliy Margolen wine-devel at kievinfo.com
Tue Aug 22 23:42:31 CDT 2006


Thursday, August 17, 2006, 8:46:12 AM, Vitaliy Margolen wrote:
> ChangeLog:
> user: Pass hook handle to the destination thread. Call server to get hook
> information for inter-thread hooks.

> Currently Wine has a major problem with LL hooks (low level hooks) when
> second hook is installed in a separate thread - the second hook callback is
> never called. And while attempting to call it Wine almost locks up in never
> ending loop. This happening because instead of calling current thread's
> hook callback Wine restarts the whole hook chain from the start.

> This patch deals with both sides of this problem.

> Fixes Bug [5803], [5712] and possibly others.

>  dlls/user/hook.c         |   41 +++++++++++++++++++++++++++++++++++++----
>  dlls/user/message.c      |   13 +++++++++----
>  dlls/user/user_private.h |    7 +++++++
>  server/hook.c            |   29 +++++++++++++++++++++++++++++
>  server/protocol.def      |   13 +++++++++++++
>  5 files changed, 95 insertions(+), 8 deletions(-)

Why wasn't this patch accepted? Alexandre on IRC said that there are some
race conditions here. I don't see how and where. The only possible place
that I can think of is passing handle from one thread to the other thread
using internal message. But that is covered. If the hook gets removed, we
don't remove it in the server: http://source.winehq.org/source/server/hook.c#L291
When new hook is added, it's being placed ahead of all others, so it's not
a problem either - we can't call it anyway after hook-chain has been
started.

Am I missing something here?

Vitaliy Margolen






More information about the wine-devel mailing list