MCPcopy Create free account
hub / github.com/F-Stack/f-stack / _mtx_destroy

Function _mtx_destroy

freebsd/kern/kern_mutex.c:1173–1199  ·  view source on GitHub ↗

* Remove lock `m' from all_mtx queue. We don't allow MTX_QUIET to be * passed in as a flag here because if the corresponding mtx_init() was * called with MTX_QUIET set, then it will already be set in the mutex's * flags. */

Source from the content-addressed store, hash-verified

1171 * flags.
1172 */
1173void
1174_mtx_destroy(volatile uintptr_t *c)
1175{
1176 struct mtx *m;
1177
1178 m = mtxlock2mtx(c);
1179
1180 if (!mtx_owned(m))
1181 MPASS(mtx_unowned(m));
1182 else {
1183 MPASS((m->mtx_lock & (MTX_RECURSED|MTX_CONTESTED)) == 0);
1184
1185 /* Perform the non-mtx related part of mtx_unlock_spin(). */
1186 if (LOCK_CLASS(&m->lock_object) == &lock_class_mtx_spin)
1187 spinlock_exit();
1188 else
1189 TD_LOCKS_DEC(curthread);
1190
1191 lock_profile_release_lock(&m->lock_object);
1192 /* Tell witness this isn't locked to make it happy. */
1193 WITNESS_UNLOCK(&m->lock_object, LOP_EXCLUSIVE, __FILE__,
1194 __LINE__);
1195 }
1196
1197 m->mtx_lock = MTX_DESTROYED;
1198 lock_destroy(&m->lock_object);
1199}
1200
1201/*
1202 * Intialize the mutex code and system mutexes. This is called from the MD

Callers

nothing calls this directly

Calls 3

lock_destroyFunction · 0.85
spinlock_exitFunction · 0.50

Tested by

no test coverage detected