blob: 36bbffbf6ae656182e56216ebae09362492946f7 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
|
/*-
* See the file LICENSE for redistribution information.
*
* Copyright (c) 2009, 2015 Oracle and/or its affiliates. All rights reserved.
*
*/
using System;
using System.Collections.Generic;
using System.Text;
using BerkeleyDB.Internal;
namespace BerkeleyDB {
/// <summary>
/// A class representing configuration parameters for a
/// <see cref="DatabaseEnvironment"/>'s mutex subsystem.
/// </summary>
public class MutexConfig {
internal bool alignmentIsSet;
private uint _alignment;
/// <summary>
/// The mutex alignment, in bytes.
/// </summary>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// <para>
/// If the database environment already exists when
/// <see cref="DatabaseEnvironment.Open"/> is called, the value of
/// Alignment is ignored.
/// </para>
/// </remarks>
public uint Alignment {
get { return _alignment; }
set {
alignmentIsSet = true;
_alignment = value;
}
}
internal bool incrementIsSet;
private uint _increment;
/// <summary>
/// Configure the number of additional mutexes to allocate.
/// </summary>
/// <remarks>
/// <para>
/// If both Increment and <see cref="MaxMutexes"/> are set, the value of
/// Increment is silently ignored.
/// </para>
/// <para>
/// If the database environment already exists when
/// <see cref="DatabaseEnvironment.Open"/> is called, the value of
/// Increment will be ignored.
/// </para>
/// </remarks>
public uint Increment {
get { return _increment; }
set {
incrementIsSet = true;
_increment = value;
}
}
internal bool initMutexesIsSet;
private uint _initmutexes;
/// <summary>
/// The initial number of mutexes to allocate.
/// </summary>
/// <remarks>
/// <para>
/// Berkeley DB allocates a default number of mutexes based on the
/// initial configuration of the database environment. This method
/// allows the user to override that default value.
/// </para>
/// <para>
/// If the database environment already exists when
/// <see cref="DatabaseEnvironment.Open"/> is called, the value of
/// InitMutexes is ignored.
/// </para>
/// </remarks>
public uint InitMutexes {
get { return _initmutexes; }
set {
initMutexesIsSet = true;
_initmutexes = value;
}
}
internal bool maxMutexesIsSet;
private uint _maxmutexes;
/// <summary>
/// The total number of mutexes to allocate.
/// </summary>
/// <remarks>
/// <para>
/// 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.
/// </para>
/// <para>
/// If both <see cref="Increment"/> and MaxMutexes are set, the value of
/// Increment is silently ignored.
/// </para>
/// <para>
/// If the database environment already exists when
/// <see cref="DatabaseEnvironment.Open"/> is called, the value of
/// MaxMutexes is ignored.
/// </para>
/// </remarks>
public uint MaxMutexes {
get { return _maxmutexes; }
set {
maxMutexesIsSet = true;
_maxmutexes = value;
}
}
internal bool numTASIsSet;
private uint _numTAS;
/// <summary>
/// The number of spins test-and-set mutexes should execute before
/// blocking.
/// </summary>
public uint NumTestAndSetSpins {
get { return _numTAS; }
set {
numTASIsSet = true;
_numTAS = value;
}
}
}
}
|