simple_lock(9r) simple_lock(9r)
NAME
simple_lock - General: Asserts a simple lock
SYNOPSIS
#include <kern/lock.h>
void simple_lock(
simple_lock_t slock_ptr );
ARGUMENTS
Specifies a pointer to a simple lock structure. You can declare this simple lock structure by using the decl_simple_lock_data routine.
DESCRIPTION
The simple_lock routine asserts a lock with exclusive access for the resource associated with the specified slock structure pointer. This
means that no other kernel thread can gain access to the locked resource until you call simple_unlock to release it. Because simple locks
are spin locks, simple_lock does not return until the lock has been obtained.
NOTES
You must call simple_lock_init (once only) prior to calling simple_lock to initialize the simple lock structure for the resource. A
resource, from the kernel module's standpoint, is data that more than one kernel thread can manipulate. You can store the resource in
global variables and in data structure members.
RETURN VALUES
None
FILES
SEE ALSO
Routines: decl_simple_lock_data(9r), simple_lock_init(9r), simple_lock_terminate(9r), simple_lock_try(9r), simple_unlock(9r)
Data Structures: slock(9s)
simple_lock(9r)