[ Previous | Next | Contents | Home | Search ]
AIX Version 4.3 Kernel and Subsystems Technical Reference, Volume 1

simple_lock or simple_lock_try Kernel Service

Purpose

Locks a simple lock.

Syntax

#include <sys/lock_def.h>
void simple_lock (lock_addr)
simple_lock_t lock_addr;
boolean_t simple_lock_try (lock_addr)
simple_lock_t lock_addr;

Parameter

lock_addr Specifies the address of the lock word to lock.

Description

The simple_lock kernel service locks the specified lock; it blocks if the lock is busy. The lock must have been previously initialized with the simple_lock_init kernel service. The simple_lock kernel service has no return values.

The simple_lock_try kernel service tries to lock the specified lock; it returns immediately without blocking if the lock is busy. If the lock is free, the simple_lock_try kernel service locks it. The lock must have been previously initialized with the simple_lock_init kernel service.

Note: When using simple locks to protect thread-interrupt critical sections, it is recommended that you use the disable_lock kernel service instead of calling the simple_lock kernel service directly.

Execution Environment

The simple_lock and simple_lock_try kernel services can be called from the process environment only.

Return Values

The simple_lock_try kernel service has the following return values:

TRUE Indicates that the simple lock has been successfully acquired.
FALSE Indicates that the simple lock is busy, and has not been acquired.

Implementation Specifics

The simple_lock and simple_lock_try kernel services are part of the Base Operating System (BOS) Runtime.

Related Information

The disable_lock kernel service, lock_mine kernel service, simple_lock_init kernel service, simple_unlock kernel service.

Understanding Locking and Locking Kernel Services in AIX Kernel Extensions and Device Support Programming Concepts


[ Previous | Next | Contents | Home | Search ]