#include <kern/lock_group.h>

kern/lock_group.h Kernel.framework

6 functions · 2 typedefs · 2 macros

typedeflck_grp_t

@typedef lck_grp_t @abstract The opaque type of a lock group. @discussion A lock group is used to denote a set of locks that serve a similar purpose, and hold an equivalent "rank" in the lock hierarchy. This structure can then provide some statistics and anchor checks in development kernels for an entire family of locks.
typedef struct _lck_grp_ lck_grp_t

macroLCK_GRP_NULL

#define LCK_GRP_NULL ((lck_grp_t *)NULL)

typedeflck_grp_attr_t

@typedef lck_grp_attr_t @abstract The opaque type for attributes to a group. @discussion A lock group attribute is meant to configure a group, as a group configuration becomes immutable once made.
typedef struct _lck_grp_attr_ lck_grp_attr_t

macroLCK_GRP_ATTR_NULL

#define LCK_GRP_ATTR_NULL ((lck_grp_attr_t *)NULL)

functionlck_grp_attr_alloc_init

extern lck_grp_attr_t *lck_grp_attr_alloc_init(void)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/lock_group.c
Allocates a lock group attribute structure and initializes it to the default values. The result is freed with lck_grp_attr_free.

functionlck_grp_attr_setdefault

extern void lck_grp_attr_setdefault(lck_grp_attr_t *attr)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/lock_group.c
Resets the lock group attribute structure to the system default values.

functionlck_grp_attr_setstat

extern void lck_grp_attr_setstat(lck_grp_attr_t *attr)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/lock_group.c
Sets the LCK_GRP_ATTR_STAT flag in the lock group attribute structure, enabling per-group lock statistics (held/miss/wait counts, gathered under CONFIG_DTRACE) for locks created in groups initialized with it.

functionlck_grp_attr_free

extern void lck_grp_attr_free(lck_grp_attr_t *attr)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/lock_group.c
Frees a lock group attribute structure previously allocated with lck_grp_attr_alloc_init.

functionlck_grp_alloc_init

extern lck_grp_t *lck_grp_alloc_init(const char *grp_name, lck_grp_attr_t *attr)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/lock_group.c
Allocates a lock group, names it grp_name (truncated to LCK_GRP_MAX_NAME), and initializes it with the given attributes (NULL selects the defaults). Lock groups label and count the spin locks, mutexes, ticket locks and rw locks initialized against them, and carry the optional statistics enabled by lck_grp_attr_setstat. The group is reference counted; release it with lck_grp_free.

functionlck_grp_free

extern void lck_grp_free(lck_grp_t *grp)
claude-fable-5, 2026-08-24 · not from Apple sources · verified against xnu osfmk/kern/lock_group.c
Drops a reference on an allocated lock group; the group is destroyed and its memory freed when the last reference (including those held by locks initialized in the group) is released.