pthread_mutex in a winelib dll called from a win32 application
rob at codeweavers.com
Wed Jul 21 06:19:29 CDT 2004
Mike Hearn wrote:
>On Wed, 21 Jul 2004 13:08:57 +0300, Shachar Shemesh wrote:
>>The problem is that when I try to call pthread_mutex_init,
>>pthread_mutex_lock and friends, I get quite a few deadlocks, and even
>>when not deadlocking, it still takes over 42 seconds. When doing the
>>same without the mutexes (I'm locking write access to a pipe - I'm not
>>sure it's even necessary, and it is working without the lock too), wine
>>performs at 21-26 seconds. I don't think that obtaining a posix mutex
>>should have such harsh effect on performance.
>What kind of mutex are you using? Critical sections should only RPC to the
>wineserver (which is the slow bit) when contended, iirc ...
>every time you block this involves a wineserver RPC so with high lock
>contention that could be a problem.
If you (Shachar) have access to the source then it might be worth adding
spin locks similar to the work just done with critical sections,
assuming this program is two processes communicating and the lock is in
high contention. In fact, it might be worth making a version of our
existing critical section code that works over shared memory and use that.
More information about the wine-devel