Important

   

This documentation space contains information about PATROL Agents when deployed in a TrueSight Operations Management environment. If you are a BMC Helix Operations Management user, see PATROL Agent 22.1 for BMC Helix Operations Management. Open link

destroy_lock()

Destroy a PSL process lock and wake all processes blocked on the lock.

Syntax

destroy_lock(lockname)

Parameters

Parameter

Definition

lockname

name of the lock that is destroyed

Description

The destroy_lock( ) function destroys lockname that was previously granted to a PSL process and wakes all processes that are blocked on it. (Processes become blocked on a lock through either the lock() or cond_wait() function calls.) The destroy_lock() function returns 1 if it successfully finds and destroys lockname, and 0 if it does not.

The lock() and cond_wait() functions set the PSL variable errno = 114 (E_PSL_LOCK_DESTROYED) if the lock upon which they are blocked is destroyed.

Example

The following example creates the lock PASSWD_FILE_LOCK and then destroys the lock using the destroy_lock() function:

if (lock("PASSWD_FILE_LOCK","w",180))
{
print("Got the lock\n");
}
else
{
print("Did not get it\n");
}
status = destroy_lock("PASSWD_FILE_LOCK");
if (status != 1)
{
print("Failed to destroy the lock\n");
}
else
{
print ("Destroyed the lock\n");
}


Was this page helpful? Yes No Submitting... Thank you

Comments