/******************************************************************************
  @header BDBLockMode
 
  @availability OS X, GNUstep
  @copyright (C) 2004, 2005, 2006 Oliver Langer
 
  Author: Oliver Langer

  This library is free software; you can redistribute it and/or
  modify it under the terms of the GNU Lesser General Public
  License as published by the Free Software Foundation; either
  version 2.1 of the License, or (at your option) any later version.

  This library is distributed in the hope that it will be useful,
  but WITHOUT ANY WARRANTY; without even the implied warranty of
  MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the GNU
  Lesser General Public License for more details.

  You should have received a copy of the GNU Lesser General Public
  License along with this library; if not, write to the Free Software
  Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA  02110-1301  USA

  <pre>
  -------------------------------------------------------------------------
  Modification history

  07.01.2005 ola     initial version
  22.08.2006 ola     license changed
  -------------------------------------------------------------------------
  </pre>
******************************************************************************/

#if !defined(__BDBLOCKMODE_H)
#define __BDBLOCKMODE_H

#include <db.h>
#include <BDB/BDBObject.h>

@interface BDBLockMode : NSObject {
@private
  u_int32_t flags;
}


/**
 * @method init
 */
- init;


/**
 * @method setReadModifyWrite
 * @abstract set up for using write locks instead of read locks during 
 *   retrieval. 
 * @discussion Setting this flag can eliminate deadlock during a 
 *   read-modify-write cycle by acquiring the write lock during the read part 
 *   of the cycle so that another thread of control acquiring a read lock for 
 *   the same item, in its own read-modify-write cycle, will not result in 
 *   deadlock.
 * @param enable YES to set up this mode
 * @result self
 */
- setReadModifyWrite: (BOOL) enable;


/**
 * @method flags
 * @result return the bdb flags. for internal usage only.
 */
- (u_int32_t) flags;
@end

#endif
