Release a PSL process lock.






name of the lock that should be released


The unlock() function releases lockname that was granted to this process by a previous call to the lock() function. The unlock() function returns 1 for success and 0 for failure. If no lock is named lockname or if it is not currently owned by this process, then the unlock() function reports a run-time error, sets the PSL errno variable, and returns 0.


All locks held by a process are automatically released when the process exits in a manner similar to executing the unlock function. BMC Software recommends that you release locks explicitly using the unlock() function rather than implicitly using the process exit.

If this process is the only one holding the lock and processes are queued for it, the first waiting process is awakened and granted use of the lock. If the first process is a shared request, then any other processes that are queued for a shared lock are also granted shared access to the lock (except for processes that are behind a writer request on the queue for this lock).


The following is an example of the unlock() function:

if (unlock(PASSWD_LOCK)) {
printf("lock released\n”);
} else {
printf("lock release failed\n”);

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