/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2009 Oracle. All rights reserved.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using BerkeleyDB.Internal;
namespace BerkeleyDB {
///
/// A class representing configuration parameters for a
/// 's mutex subsystem.
///
public class MutexConfig {
internal bool alignmentIsSet;
private uint _alignment;
///
/// The mutex alignment, in bytes.
///
///
///
/// It is sometimes advantageous to align mutexes on specific byte
/// boundaries in order to minimize cache line collisions. Alignment
/// specifies an alignment for mutexes allocated by Berkeley DB.
///
///
/// If the database environment already exists when
/// is called, the value of
/// Alignment will be ignored.
///
///
public uint Alignment {
get { return _alignment; }
set {
alignmentIsSet = true;
_alignment = value;
}
}
internal bool incrementIsSet;
private uint _increment;
///
/// Configure the number of additional mutexes to allocate.
///
///
///
/// If both Increment and are set, the value of
/// Increment will be silently ignored.
///
///
/// If the database environment already exists when
/// is called, the value of
/// Increment will be ignored.
///
///
public uint Increment {
get { return _increment; }
set {
incrementIsSet = true;
_increment = value;
}
}
internal bool maxIsSet;
private uint _max;
///
/// The total number of mutexes to allocate.
///
///
///
/// Berkeley DB allocates a default number of mutexes based on the
/// initial configuration of the database environment. That default
/// calculation may be too small if the application has an unusual need
/// for mutexes (for example, if the application opens an unexpectedly
/// large number of databases) or too large (if the application is
/// trying to minimize its memory footprint). MaxMutexes is used to
/// specify an absolute number of mutexes to allocate.
///
///
/// If both and MaxMutexes are set, the value of
/// Increment will be silently ignored.
///
///
/// If the database environment already exists when
/// is called, the value of
/// MaxMutexes will be ignored.
///
///
public uint MaxMutexes {
get { return _max; }
set {
maxIsSet = true;
_max = value;
}
}
internal bool numTASIsSet;
private uint _numTAS;
///
/// The number of spins test-and-set mutexes should execute before
/// blocking.
///
public uint NumTestAndSetSpins {
get { return _numTAS; }
set {
numTASIsSet = true;
_numTAS = value;
}
}
}
}