1 /******************************************************************************
2   @header BDBLockMode
3 
4   @availability OS X, GNUstep
5   @copyright (C) 2004, 2005, 2006 Oliver Langer
6 
7   Author: Oliver Langer
8 
9   This library is free software; you can redistribute it and/or
10   modify it under the terms of the GNU Lesser General Public
11   License as published by the Free Software Foundation; either
12   version 2.1 of the License, or (at your option) any later version.
13 
14   This library is distributed in the hope that it will be useful,
15   but WITHOUT ANY WARRANTY; without even the implied warranty of
16   MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
17   Lesser General Public License for more details.
18 
19   You should have received a copy of the GNU Lesser General Public
20   License along with this library; if not, write to the Free Software
21   Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA
22 
23   <pre>
24   -------------------------------------------------------------------------
25   Modification history
26 
27   07.01.2005 ola     initial version
28   22.08.2006 ola     license changed
29   -------------------------------------------------------------------------
30   </pre>
31 ******************************************************************************/
32 
33 #if !defined(__BDBLOCKMODE_H)
34 #define __BDBLOCKMODE_H
35 
36 #include <db.h>
37 #include <BDB/BDBObject.h>
38 
39 @interface BDBLockMode : NSObject {
40 @private
41   u_int32_t flags;
42 }
43 
44 
45 /**
46  * @method init
47  */
48 - init;
49 
50 
51 /**
52  * @method setReadModifyWrite
53  * @abstract set up for using write locks instead of read locks during
54  *   retrieval.
55  * @discussion Setting this flag can eliminate deadlock during a
56  *   read-modify-write cycle by acquiring the write lock during the read part
57  *   of the cycle so that another thread of control acquiring a read lock for
58  *   the same item, in its own read-modify-write cycle, will not result in
59  *   deadlock.
60  * @param enable YES to set up this mode
61  * @result self
62  */
63 - setReadModifyWrite: (BOOL) enable;
64 
65 
66 /**
67  * @method flags
68  * @result return the bdb flags. for internal usage only.
69  */
70 - (u_int32_t) flags;
71 @end
72 
73 #endif
74