2 * See the file LICENSE for redistribution information.
4 * Copyright (c) 2009, 2012 Oracle and/or its affiliates. All rights reserved.
8 using System.Collections.Generic;
10 using BerkeleyDB.Internal;
12 namespace BerkeleyDB {
14 /// A class representing configuration parameters for a
15 /// <see cref="DatabaseEnvironment"/>'s mutex subsystem.
17 public class MutexConfig {
18 internal bool alignmentIsSet;
19 private uint _alignment;
21 /// The mutex alignment, in bytes.
25 /// It is sometimes advantageous to align mutexes on specific byte
26 /// boundaries in order to minimize cache line collisions. Alignment
27 /// specifies an alignment for mutexes allocated by Berkeley DB.
30 /// If the database environment already exists when
31 /// <see cref="DatabaseEnvironment.Open"/> is called, the value of
32 /// Alignment will be ignored.
35 public uint Alignment {
36 get { return _alignment; }
38 alignmentIsSet = true;
43 internal bool incrementIsSet;
44 private uint _increment;
46 /// Configure the number of additional mutexes to allocate.
50 /// If both Increment and <see cref="MaxMutexes"/> are set, the value of
51 /// Increment will be silently ignored.
54 /// If the database environment already exists when
55 /// <see cref="DatabaseEnvironment.Open"/> is called, the value of
56 /// Increment will be ignored.
59 public uint Increment {
60 get { return _increment; }
62 incrementIsSet = true;
67 internal bool initMutexesIsSet;
68 private uint _initmutexes;
70 /// The initial number of mutexes to allocate.
74 /// Berkeley DB allocates a default number of mutexes based on the
75 /// initial configuration of the database environment. This method
76 /// allows the user to override that default value.
79 /// If the database environment already exists when
80 /// <see cref="DatabaseEnvironment.Open"/> is called, the value of
81 /// InitMutexes will be ignored.
84 public uint InitMutexes {
85 get { return _initmutexes; }
87 initMutexesIsSet = true;
92 internal bool maxMutexesIsSet;
93 private uint _maxmutexes;
95 /// The total number of mutexes to allocate.
99 /// Berkeley DB allocates a default number of mutexes based on the
100 /// initial configuration of the database environment. That default
101 /// calculation may be too small if the application has an unusual need
102 /// for mutexes (for example, if the application opens an unexpectedly
103 /// large number of databases) or too large (if the application is
104 /// trying to minimize its memory footprint). MaxMutexes is used to
105 /// specify an absolute number of mutexes to allocate.
108 /// If both <see cref="Increment"/> and MaxMutexes are set, the value of
109 /// Increment will be silently ignored.
112 /// If the database environment already exists when
113 /// <see cref="DatabaseEnvironment.Open"/> is called, the value of
114 /// MaxMutexes will be ignored.
117 public uint MaxMutexes {
118 get { return _maxmutexes; }
120 maxMutexesIsSet = true;
125 internal bool numTASIsSet;
126 private uint _numTAS;
128 /// The number of spins test-and-set mutexes should execute before
131 public uint NumTestAndSetSpins {
132 get { return _numTAS; }