On 10/27/05, Marcus Meissner marcus@jet.franken.de wrote:
- Threading
On several places we use third-party components that use native pthreads from which we receive callbacks in different pthreads.
Is it possible to use Wine/pthread mix? What would be the preferred way of doing things?
Umm. I do not know. It might be possible.
We provide a kind of barebones pthread implementation ourselves to help this mix.
It's safest if you can keep the Windows and Linux parts of your product in separate processes, and communicate via IPC (say, sockets). Would that be possible for you, ssawai?
Our tests show that Wine implements Win32 threads by creating new processes (via clone() syscall). This is a problem, because, pthreads spawned from Wine thread, cannot be interlocked with Wine/Win32 Mutex or CriticalSection. They also seem to be scheduled (by kernel) only within parent Wine thread. If parent Wine thread terminates early - we have a crash the moment when one of the orphan pthreads try to place a callback.
If you're talking about mixing pthreads and wine threads still, yeah, all bets are off. If you're talking about pure win32 stuff, please give more details.
Can you help with these? If not, can you suggest who may be able to give us some expert insight with our issues?
I hope some of the other developers on wine-devel@winehq.org can fill in here.
Don't forget - there's always the option of calling in the professionals. There are contractors who can help you if you are able to afford the fee. - Dan