mirror of
https://github.com/mozilla/gecko-dev.git
synced 2024-11-01 22:55:23 +00:00
123 lines
5.7 KiB
HTML
123 lines
5.7 KiB
HTML
<HTML>
|
|
<HEAD>
|
|
<TITLE>DbLock</TITLE>
|
|
</HEAD>
|
|
<BODY BGCOLOR=white>
|
|
<H1>DbLock</H1>
|
|
<HR SIZE=1 NOSHADE>
|
|
<PRE>
|
|
<!-- Manpage converted by man2html 3.0.1 -->
|
|
<B>#include</B> <B><db</B>_<B>cxx.h></B>
|
|
|
|
<B>int</B>
|
|
<B>DbLock::put(DbLockTab</B> <B>*lt);</B>
|
|
|
|
<B>unsigned</B> <B>int</B>
|
|
<B>DbLock::get</B>_<B>lock</B>_<B>id();</B>
|
|
|
|
<B>void</B>
|
|
<B>DbLock::set</B>_<B>lock</B>_<B>id(unsigned</B> <B>int);</B>
|
|
|
|
<B>DBLock::DbLock(unsigned</B> <B>int);</B>
|
|
<B>DBLock::DbLock();</B>
|
|
<B>DBLock::DbLock(const</B> <B>DbLock</B> <B>&);</B>
|
|
<B>DbLock</B> <B>&DBLock::operator</B> <B>=</B> <B>(const</B> <B>DbLock</B> <B>&);</B>
|
|
|
|
|
|
</PRE>
|
|
<H2>DESCRIPTION</H2><PRE>
|
|
The DB library is a family of classes that provides a
|
|
modular programming interface to transactions and record-
|
|
oriented file access. The library includes support for
|
|
transactions, locking, logging and file page caching, as
|
|
well as various indexed access methods. Many of the
|
|
classes (e.g., the file page caching class) are useful
|
|
independent of the other DB classes, although some classes
|
|
are explicitly based on other classes (e.g., transactions
|
|
and logging). For a general description of the DB
|
|
package, see <B><A HREF="db_intro.html">db_intro(3)</A></B>.
|
|
|
|
This manual page describes the specific details of the
|
|
locking interface. The DbLock class is used in
|
|
conjunction with <B><A HREF="DbLockTab.html">DbLockTab(3)</A></B> to provide general-purpose
|
|
locking. While designed to work with the other Db
|
|
classes, these classes are also useful for more general
|
|
locking purposes. Locks can be shared between processes.
|
|
In most cases, when multiple threads or processes are
|
|
using locking, the deadlock detector, <B><A HREF="db_deadlock.html">db_deadlock(1)</A></B>,
|
|
should be run.
|
|
|
|
DbLock::put
|
|
The DbLock::put method is a simple interface to the
|
|
DbLockTab::vec functionality, and is equivalent to calling
|
|
the DbLockTab::vec method with a single element list
|
|
array, for which the op field is DB_LOCK_PUT and the lock
|
|
field is represented by the DbLock object. The
|
|
DbLock::put method returns success and failure as
|
|
described for the DbLockTab::vec method.
|
|
|
|
DbLock::get_lock_id
|
|
The DbLock::get_lock_id method gets the underlying
|
|
representation of the lock id. Direct manipulation of the
|
|
underlying representation is not recommended.
|
|
|
|
DbLock::set_lock_id
|
|
The DbLock::set_lock_id method sets the underlying
|
|
representation of the lock id. Direct manipulation of the
|
|
underlying representation is not recommended. Rather,
|
|
DbLockTab::get should be used to initialize locks (see
|
|
<B><A HREF="DbLockTab.html">DbLockTab(3)</A></B>), and the copy constructor and assignment
|
|
operators can be used to assign to other DbLock objects.
|
|
|
|
|
|
</PRE>
|
|
<H2>ERRORS</H2><PRE>
|
|
Methods marked as returning errno will, by default, throw
|
|
an exception that encapsulates the error information. The
|
|
default error behavior can be changed, see <B><A HREF="DbException.html">DbException(3)</A></B>.
|
|
|
|
The DbLock::put method may fail and throw a <B><A HREF="DbException.html">DbException(3)</A></B>
|
|
|
|
or return errno for any of the errors specified for the
|
|
following DB and library functions: <B><A HREF="DbLock.html">DbLock::detect(3)</A></B>,
|
|
<B>fcntl(2)</B>, <B>fflush(3)</B>, <B>lseek(2)</B>, <B>memcpy(3)</B>, <B>memset(3)</B>,
|
|
<B>mmap(2)</B>, <B>munmap(2)</B>, <B>strerror(3)</B>, and <B>write(2)</B>.
|
|
|
|
In addition, the DbLock::put method may fail and throw a
|
|
<B><A HREF="DbException.html">DbException(3)</A></B> or return errno for the following
|
|
conditions:
|
|
|
|
[EACCES]
|
|
An attempt was made to release lock held by another
|
|
locker.
|
|
|
|
[EINVAL]
|
|
An invalid flag value or parameter was specified.
|
|
|
|
|
|
</PRE>
|
|
<H2>BUGS</H2><PRE>
|
|
If a process dies while holding locks, those locks remain
|
|
held and are <B>never</B> released. In this case, all processes
|
|
should exit as quickly as possible, so that db_recover can
|
|
be run.
|
|
|
|
|
|
</PRE>
|
|
<H2>SEE ALSO</H2><PRE>
|
|
<B><A HREF="db_archive.html">db_archive(1)</A></B>, <B><A HREF="db_checkpoint.html">db_checkpoint(1)</A></B>, <B><A HREF="db_deadlock.html">db_deadlock(1)</A></B>, <B><A HREF="db_dump.html">db_dump(1)</A></B>,
|
|
<B><A HREF="db_load.html">db_load(1)</A></B>, <B><A HREF="db_recover.html">db_recover(1)</A></B>, <B><A HREF="db_stat.html">db_stat(1)</A></B>, <B><A HREF="db_intro.html">db_intro(3)</A></B>,
|
|
<B><A HREF="db_internal.html">db_internal(3)</A></B>, <B><A HREF="db_thread.html">db_thread(3)</A></B>, <B><A HREF="Db.html">Db(3)</A></B>, <B><A HREF="Dbc.html">Dbc(3)</A></B>, <B><A HREF="DbEnv.html">DbEnv(3)</A></B>,
|
|
<B><A HREF="DbException.html">DbException(3)</A></B>, <B><A HREF="DbInfo.html">DbInfo(3)</A></B>, <B><A HREF="DbLock.html">DbLock(3)</A></B>, <B><A HREF="DbLockTab.html">DbLockTab(3)</A></B>, <B><A HREF="DbLog.html">DbLog(3)</A></B>,
|
|
<B><A HREF="DbLsn.html">DbLsn(3)</A></B>, <B><A HREF="DbMpool.html">DbMpool(3)</A></B>, <B><A HREF="DbMpoolFile.html">DbMpoolFile(3)</A></B>, <B><A HREF="Dbt.html">Dbt(3)</A></B>, <B><A HREF="DbTxn.html">DbTxn(3)</A></B>,
|
|
<B><A HREF="DbTxnMgr.html">DbTxnMgr(3)</A></B>
|
|
|
|
</PRE>
|
|
<HR SIZE=1 NOSHADE>
|
|
<ADDRESS>
|
|
Man(1) output converted with
|
|
<a href="http://www.oac.uci.edu/indiv/ehood/man2html.html">man2html</a>
|
|
</ADDRESS>
|
|
</BODY>
|
|
</HTML>
|