[ Bottom of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]

Technical Reference: Kernel and Subsystems, Volume 1

lock_write or lock_try_write Kernel Service

Purpose

Locks a complex lock in exclusive-write mode.

Syntax

#include <sys/lock_def.h>


void lock_write ( lock_addr)
complex_lock_t lock_addr;


boolean_t lock_try_write ( lock_addr)
complex_lock_t lock_addr;

Parameter

lock_addr Specifies the address of the lock word to lock.

Description

The lock_write kernel service locks the specified complex lock in exclusive-write mode; it blocks if the lock is busy. The lock must have been previously initialized with the lock_init kernel service. The lock_write kernel service has no return values.

The lock_try_write kernel service tries to lock the specified complex lock in exclusive-write mode; it returns immediately without blocking if the lock is busy. The lock must have been previously initialized with the lock_init kernel service.

Execution Environment

The lock_write and lock_try_write kernel services can be called from the process environment only.

Return Values

The lock_try_write kernel service has the following parameters:

TRUE Indicates that the lock was successfully acquired.
FALSE Indicates that the lock was not acquired.

Related Information

The lock_init kernel service, lock_islocked kernel service, lock_done kernel service, lock_read_to_write kernel service, lock_try_read_to_write kernel service, lock_write_to_read kernel service.

Understanding Locking and Locking Kernel Services in AIX 5L Version 5.2 Kernel Extensions and Device Support Programming Concepts

[ Top of Page | Previous Page | Next Page | Contents | Index | Library Home | Legal | Search ]