lock_set_recursive Kernel Service

Purpose

Prepares a complex lock for recursive use.

Syntax

#include <sys/lock_def.h>
void lock_set_recursive (lock_addr)
complex_lock_t lock_addr;

Parameter

Item Description
lock_addr Specifies the address of the lock word to be prepared for recursive use.

Description

The lock_set_recursive kernel service prepares the specified complex lock for recursive use. A complex lock cannot be nested until the lock_set_recursive kernel service is called for it. The calling kernel thread must hold the specified complex lock in write-exclusive mode.

When a complex lock is used recursively, the lock_done kernel service must be called once for each time that the thread is locked in order to unlock the lock.

Only the kernel thread which calls the lock_set_recursive kernel service for a lock may acquire that lock recursively.

Note: The lock_set_recursive and lock_clear_recursive kernel services must be used in pairs and must be called only when recursion is likely to occur. The lock_set_recursive kernel service must be called after making a call to the lock_write kernel service and the lock_clear_recursive kernel service must be called before making the call to the lock_done kernel service in routines where recursion might occur down the call stack.

Execution Environment

The lock_set_recursive kernel service can be called from process environment only.

Return Values

The lock_set_recursive kernel service has no return values.