/* mark a chain as locked without actually locking it. Warning! use with great caution! */ _PUBLIC_ int tdb_chainlock_mark(struct tdb_context *tdb, TDB_DATA key) { int ret = tdb_nest_lock(tdb, lock_offset(BUCKET(tdb->hash_fn(&key))), F_WRLCK, TDB_LOCK_MARK_ONLY); tdb_trace_1rec(tdb, "tdb_chainlock_mark", key); return ret; }
_PUBLIC_ int tdb_chainlock_read(struct tdb_context *tdb, TDB_DATA key) { int ret; ret = tdb_lock(tdb, BUCKET(tdb->hash_fn(&key)), F_RDLCK); tdb_trace_1rec(tdb, "tdb_chainlock_read", key); return ret; }
_PUBLIC_ int tdb_chainunlock(struct tdb_context *tdb, TDB_DATA key) { tdb_trace_1rec(tdb, "tdb_chainunlock", key); return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK); }
/* unmark a chain as locked without actually locking it. Warning! use with great caution! */ _PUBLIC_ int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key) { tdb_trace_1rec(tdb, "tdb_chainlock_unmark", key); return tdb_nest_unlock(tdb, lock_offset(BUCKET(tdb->hash_fn(&key))), F_WRLCK, true); }
int tdb_chainunlock_read(struct tdb_context *tdb, TDB_DATA key) { tdb_trace_1rec(tdb, "tdb_chainunlock_read", key); return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_RDLCK); }
/* unmark a chain as locked without actually locking it. Warning! use with great caution! */ int tdb_chainlock_unmark(struct tdb_context *tdb, TDB_DATA key) { tdb_trace_1rec(tdb, "tdb_chainlock_unmark", key); return tdb_unlock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK | TDB_MARK_LOCK); }
/* lock/unlock one hash chain. This is meant to be used to reduce contention - it cannot guarantee how many records will be locked */ int tdb_chainlock(struct tdb_context *tdb, TDB_DATA key) { int ret = tdb_lock(tdb, BUCKET(tdb->hash_fn(&key)), F_WRLCK); tdb_trace_1rec(tdb, "tdb_chainlock", key); return ret; }