mirror of
https://git.FreeBSD.org/src.git
synced 2025-01-18 15:30:21 +00:00
- Restore old mutex code from libc_r. It is more standards compliant.
This was changed because originally we were blocking on the umtx and allowing the kernel to do the queueing. It was decided that the lib should queue and start the threads in the order it decides and the umtx code would just be used like spinlocks.
This commit is contained in:
parent
48d2549c3e
commit
360a519459
Notes:
svn2git
2020-12-20 02:59:44 +00:00
svn path=/head/; revision=112958
File diff suppressed because it is too large
Load Diff
@ -156,13 +156,43 @@ struct pthread_mutex_attr {
|
||||
{ PTHREAD_MUTEXATTR_STATIC_INITIALIZER, UMTX_INITIALIZER, NULL, \
|
||||
0, 0, TAILQ_INITIALIZER }
|
||||
|
||||
union pthread_mutex_data {
|
||||
void *m_ptr;
|
||||
int m_count;
|
||||
};
|
||||
|
||||
struct pthread_mutex {
|
||||
struct pthread_mutex_attr m_attr; /* Mutex attributes. */
|
||||
struct umtx m_mtx; /* Mutex. */
|
||||
struct pthread *m_owner; /* Current owner. */
|
||||
int m_count; /* Recursion count. */
|
||||
int m_refcount; /* Reference count. */
|
||||
TAILQ_ENTRY(pthread_mutex) m_qe; /* All locks held. */
|
||||
enum pthread_mutextype m_type;
|
||||
int m_protocol;
|
||||
TAILQ_HEAD(mutex_head, pthread) m_queue;
|
||||
struct pthread *m_owner;
|
||||
union pthread_mutex_data m_data;
|
||||
long m_flags;
|
||||
int m_refcount;
|
||||
|
||||
/*
|
||||
* Used for priority inheritence and protection.
|
||||
*
|
||||
* m_prio - For priority inheritence, the highest active
|
||||
* priority (threads locking the mutex inherit
|
||||
* this priority). For priority protection, the
|
||||
* ceiling priority of this mutex.
|
||||
* m_saved_prio - mutex owners inherited priority before
|
||||
* taking the mutex, restored when the owner
|
||||
* unlocks the mutex.
|
||||
*/
|
||||
int m_prio;
|
||||
int m_saved_prio;
|
||||
|
||||
/*
|
||||
* Link for list of all mutexes a thread currently owns.
|
||||
*/
|
||||
TAILQ_ENTRY(pthread_mutex) m_qe;
|
||||
|
||||
/*
|
||||
* Lock for accesses to this structure.
|
||||
*/
|
||||
spinlock_t lock;
|
||||
};
|
||||
|
||||
/*
|
||||
|
Loading…
Reference in New Issue
Block a user