design problems with thread init code?

Paul Davis paul at
Sun Mar 28 22:53:15 CST 2004

hello. i'm the main author of Ardour and JACK, projects those of you
with audio/music leanings may be aware of. i'm in the middle of trying
to add "native" windows/x86 VST plugin support to these systems, and
i ran into some problems. #winehackers suggested to write this list.

we are using a modified version of the Mono hack that allows use of
winelib as a shared library. i got things working very well until i
tried to use a VST plugin that appears to call RtlCreateUserThread. 

in tracking down why it wouldn't work, i discovered that
server_init_thread() is called from the NT DLL for 2 reasons:

    1) to initialize the first thread in a winelib-supported program
    2) to initialize all later threads

there appear to be some problems caused by this. server_init_thread()
makes a rather basic assumption: the thread making the request is the
target of the request. this is true for case (1) but not for
case(2). in case (2), AFAICT, all (most?) instances of "current" need
to be replaced by a struct thread* that points to the newly created
(but not yet running) thread that is being initialized.

it wouldn't suprise me if i have misunderstood things here, but i was
able to fix the first problem i encountered (a complaint that the new
thread was already running) by adding a kludgy hack based on my
understanding. the next problem emerges because the new thread doesn't
get its reply/wait fd's set up (instead, the operation is done on

comments? thanks.


More information about the wine-devel mailing list