.TH lock() "" "" "Internal Kernel Routine"
.PC "Lock a gate"
.B "#include <sys/types.h>"
\fBvoid lock(\fIg\^\fB)\fR
\fBGATE \fIg\^\fB;\fR
.PP
.B lock()
waits for the gate \fIg\fR to unlock, then locks it.
When the gate of a system resource is locked,
no other processes can use the resource.
Gates must be in the kernel's data segment, not on the stack.
Because it may call
.BR sleep() ,
.B lock()
is
.I never
called from within an interrupt handler,
block routine, deferred function, or timed function.
.SH "See Also"
.B
internal kernel routines,
locked()
.R
