MCPcopy Create free account
hub / github.com/Snapchat/KeyDB / malloc_mutex_trylock

Function malloc_mutex_trylock

deps/jemalloc/include/jemalloc/internal/mutex.h:177–190  ·  view source on GitHub ↗

Trylock: return false if the lock is successfully acquired. */

Source from the content-addressed store, hash-verified

175
176/* Trylock: return false if the lock is successfully acquired. */
177static inline bool
178malloc_mutex_trylock(tsdn_t *tsdn, malloc_mutex_t *mutex) {
179 witness_assert_not_owner(tsdn_witness_tsdp_get(tsdn), &mutex->witness);
180 if (isthreaded) {
181 if (malloc_mutex_trylock_final(mutex)) {
182 atomic_store_b(&mutex->locked, true, ATOMIC_RELAXED);
183 return true;
184 }
185 mutex_owner_stats_update(tsdn, mutex);
186 }
187 witness_lock(tsdn_witness_tsdp_get(tsdn), &mutex->witness);
188
189 return false;
190}
191
192/* Aggregate lock prof data. */
193static inline void

Calls 4

witness_assert_not_ownerFunction · 0.70
mutex_owner_stats_updateFunction · 0.70
witness_lockFunction · 0.70

Tested by

no test coverage detected