[Bug 26500] Suggestion: throw out custom realization and use pthread_mutex_t

wine-bugs at winehq.org wine-bugs at winehq.org
Mon Mar 21 05:00:12 CDT 2011


http://bugs.winehq.org/show_bug.cgi?id=26500

Vladimir Voznesensky <vvoznesensky at gmail.com> changed:

           What    |Removed                     |Added
----------------------------------------------------------------------------
             Status|CLOSED                      |UNCONFIRMED
         Resolution|INVALID                     |

--- Comment #4 from Vladimir Voznesensky <vvoznesensky at gmail.com> 2011-03-21 05:00:12 CDT ---
(In reply to comment #3)
> Besides, critical section implementation uses futexes on Linux to speed up
> waiting.

Dear Dmitry, I'm sorry.
Please, look _carefully_ at pthread_mutex_lock realization. It uses both
futexes and events!

Declaration:
struct pthread_mutex
{
  long lock;                // Exclusive access to mutex state:
                            //  0: unlocked/free
                            //  1: locked - no other waiters
                            // -1: locked - with possible other waiters

  long recursion;           // Number of unlocks a thread needs to perform
                            // before the lock is released (recursive mutexes
only)
  int kind;                 // Mutex type
  pthread_t owner;          // Thread owning the mutex
  handle_t event;           // Mutex release notification to waiting threads
};
Look here for realization:
http://www.jbox.dk/sanos/source/lib/pthread/mutex.c.html#:105

lock variable is used for futex AND event is used for kernel synchronization!

-- 
Configure bugmail: http://bugs.winehq.org/userprefs.cgi?tab=email
Do not reply to this email, post in Bugzilla using the
above URL to reply.
------- You are receiving this mail because: -------
You are watching all bug changes.



More information about the wine-bugs mailing list