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

Function _sx_slock_int

freebsd/kern/kern_sx.c:1253–1283  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

1251}
1252
1253int
1254_sx_slock_int(struct sx *sx, int opts LOCK_FILE_LINE_ARG_DEF)
1255{
1256 struct thread *td;
1257 uintptr_t x;
1258 int error;
1259
1260 KASSERT(kdb_active != 0 || SCHEDULER_STOPPED() ||
1261 !TD_IS_IDLETHREAD(curthread),
1262 ("sx_slock() by idle thread %p on sx %s @ %s:%d",
1263 curthread, sx->lock_object.lo_name, file, line));
1264 KASSERT(sx->sx_lock != SX_LOCK_DESTROYED,
1265 ("sx_slock() of destroyed sx @ %s:%d", file, line));
1266 WITNESS_CHECKORDER(&sx->lock_object, LOP_NEWORDER, file, line, NULL);
1267
1268 error = 0;
1269 td = curthread;
1270 x = SX_READ_VALUE(sx);
1271 if (__predict_false(LOCKSTAT_PROFILE_ENABLED(sx__acquire) ||
1272 !__sx_slock_try(sx, td, &x, true LOCK_FILE_LINE_ARG)))
1273 error = _sx_slock_hard(sx, opts, x LOCK_FILE_LINE_ARG);
1274 else
1275 lock_profile_obtain_lock_success(&sx->lock_object, 0, 0,
1276 file, line);
1277 if (error == 0) {
1278 LOCK_LOG_LOCK("SLOCK", &sx->lock_object, 0, 0, file, line);
1279 WITNESS_LOCK(&sx->lock_object, 0, file, line);
1280 TD_LOCKS_INC(curthread);
1281 }
1282 return (error);
1283}
1284
1285int
1286_sx_slock(struct sx *sx, int opts, const char *file, int line)

Callers

nothing calls this directly

Calls 3

__sx_slock_tryFunction · 0.85
_sx_slock_hardFunction · 0.85

Tested by

no test coverage detected