Lines Matching full:mutex
10 /* Can only acquire one mutex of a given witness rank at a time. */
25 * bouncing: the data is not touched by the mutex holder
27 * contenders. Having it before the mutex itself could
106 WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
110 WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
114 WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
119 WITNESS_INITIALIZER("mutex", WITNESS_RANK_OMIT)}
129 bool malloc_mutex_init(malloc_mutex_t *mutex, const char *name,
131 void malloc_mutex_prefork(tsdn_t *tsdn, malloc_mutex_t *mutex);
132 void malloc_mutex_postfork_parent(tsdn_t *tsdn, malloc_mutex_t *mutex);
133 void malloc_mutex_postfork_child(tsdn_t *tsdn, malloc_mutex_t *mutex);
135 void malloc_mutex_prof_data_reset(tsdn_t *tsdn, malloc_mutex_t *mutex);
137 void malloc_mutex_lock_slow(malloc_mutex_t *mutex);
140 malloc_mutex_lock_final(malloc_mutex_t *mutex) { in malloc_mutex_lock_final() argument
141 MALLOC_MUTEX_LOCK(mutex); in malloc_mutex_lock_final()
145 malloc_mutex_trylock_final(malloc_mutex_t *mutex) { in malloc_mutex_trylock_final() argument
146 return MALLOC_MUTEX_TRYLOCK(mutex); in malloc_mutex_trylock_final()
150 mutex_owner_stats_update(tsdn_t *tsdn, malloc_mutex_t *mutex) { in mutex_owner_stats_update() argument
152 mutex_prof_data_t *data = &mutex->prof_data; in mutex_owner_stats_update()
163 malloc_mutex_trylock(tsdn_t *tsdn, malloc_mutex_t *mutex) { in malloc_mutex_trylock() argument
164 witness_assert_not_owner(tsdn_witness_tsdp_get(tsdn), &mutex->witness); in malloc_mutex_trylock()
166 if (malloc_mutex_trylock_final(mutex)) { in malloc_mutex_trylock()
169 mutex_owner_stats_update(tsdn, mutex); in malloc_mutex_trylock()
171 witness_lock(tsdn_witness_tsdp_get(tsdn), &mutex->witness); in malloc_mutex_trylock()
201 malloc_mutex_lock(tsdn_t *tsdn, malloc_mutex_t *mutex) { in malloc_mutex_lock() argument
202 witness_assert_not_owner(tsdn_witness_tsdp_get(tsdn), &mutex->witness); in malloc_mutex_lock()
204 if (malloc_mutex_trylock_final(mutex)) { in malloc_mutex_lock()
205 malloc_mutex_lock_slow(mutex); in malloc_mutex_lock()
207 mutex_owner_stats_update(tsdn, mutex); in malloc_mutex_lock()
209 witness_lock(tsdn_witness_tsdp_get(tsdn), &mutex->witness); in malloc_mutex_lock()
213 malloc_mutex_unlock(tsdn_t *tsdn, malloc_mutex_t *mutex) { in malloc_mutex_unlock() argument
214 witness_unlock(tsdn_witness_tsdp_get(tsdn), &mutex->witness); in malloc_mutex_unlock()
216 MALLOC_MUTEX_UNLOCK(mutex); in malloc_mutex_unlock()
221 malloc_mutex_assert_owner(tsdn_t *tsdn, malloc_mutex_t *mutex) { in malloc_mutex_assert_owner() argument
222 witness_assert_owner(tsdn_witness_tsdp_get(tsdn), &mutex->witness); in malloc_mutex_assert_owner()
226 malloc_mutex_assert_not_owner(tsdn_t *tsdn, malloc_mutex_t *mutex) { in malloc_mutex_assert_not_owner() argument
227 witness_assert_not_owner(tsdn_witness_tsdp_get(tsdn), &mutex->witness); in malloc_mutex_assert_not_owner()
230 /* Copy the prof data from mutex for processing. */
233 malloc_mutex_t *mutex) { in malloc_mutex_prof_read() argument
234 mutex_prof_data_t *source = &mutex->prof_data; in malloc_mutex_prof_read()
235 /* Can only read holding the mutex. */ in malloc_mutex_prof_read()
236 malloc_mutex_assert_owner(tsdn, mutex); in malloc_mutex_prof_read()
240 * atomic data), but the mutex protection makes this safe, and writing in malloc_mutex_prof_read()