66 lines
1.4 KiB
Groff
66 lines
1.4 KiB
Groff
|
.\" $Id: JAM_LockMB.3,v 1.1 2002/11/09 00:37:16 raorn Exp $
|
||
|
.\"
|
||
|
.TH JAM_LockMB 3 2002-11-07 "" "JAM subroutine library"
|
||
|
.SH NAME
|
||
|
JAM_LockMB \- Lock message base for exclusive access
|
||
|
.SH SYNOPSIS
|
||
|
.nf
|
||
|
.B #include <jamlib/jam.h>
|
||
|
|
||
|
.BI "int JAM_LockMB(s_JamBase* " Base_PS ");"
|
||
|
.RE
|
||
|
.fi
|
||
|
.SH DESCRIPTION
|
||
|
Locks the currently open message base so that no other programs may
|
||
|
modify it. The message base should be locked for only small periods
|
||
|
of time, or the performance of tossers and other software may be
|
||
|
affected.
|
||
|
.SS Arguments
|
||
|
.TP
|
||
|
.I Base_PS
|
||
|
The message base to lock
|
||
|
.SH RETURN VALUE
|
||
|
.TP
|
||
|
.B 0
|
||
|
if successful
|
||
|
.TP
|
||
|
.B JAM_IO_ERROR
|
||
|
if an I/O error occured. see
|
||
|
.BR JAM_Errno (3)
|
||
|
.TP
|
||
|
.B JAM_LOCK_FAILED
|
||
|
if the message base is currently locked by another
|
||
|
process
|
||
|
.TP
|
||
|
.B JAM_BAD_PARAM
|
||
|
if \fIBase_PS\fP is NULL
|
||
|
.SH EXAMPLES
|
||
|
.nf
|
||
|
int Result_I;
|
||
|
|
||
|
while (1) {
|
||
|
Result_I = JAM_LockMB(Base_PS);
|
||
|
if (Result_I) {
|
||
|
|
||
|
if (Result_I == JAM_LOCK_FAILED)
|
||
|
/* base locked by someone else, wait for unlock */
|
||
|
sleep(1);
|
||
|
|
||
|
else {
|
||
|
/* error */
|
||
|
printf("JAM_LockMB returned %d.\\n", Result_I);
|
||
|
return \-1;
|
||
|
}
|
||
|
}
|
||
|
}
|
||
|
.fi
|
||
|
.SH AUTHOR
|
||
|
This manual page was created by Sir Raorn <raorn@altlinux.ru>,
|
||
|
based on original JAMlib documentation by Bjorn Stenberg
|
||
|
<bjorn@haxx.nu> and Johan Billing <billing@df.lth.se>.
|
||
|
.SH SEE ALSO
|
||
|
.BR jamlib (3),
|
||
|
.BR JAM_UnlockMB (3),
|
||
|
.BR JAM_Errno (3)
|
||
|
.\" vim: ft=nroff
|