aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs
diff options
context:
space:
mode:
authorDavid Walter Seikel2016-11-03 21:44:39 +1000
committerDavid Walter Seikel2016-11-03 21:44:39 +1000
commit134f86e8d5c414409631b25b8c6f0ee45fbd8631 (patch)
tree216b89d3fb89acfb81be1e440c25c41ab09fa96d /OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs
parentMore changing to production grid. Double oops. (diff)
downloadopensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.zip
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.gz
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.bz2
opensim-SC_OLD-134f86e8d5c414409631b25b8c6f0ee45fbd8631.tar.xz
Initial update to OpenSim 0.8.2.1 source code.
Diffstat (limited to '')
-rw-r--r--OpenSim/Framework/ThreadSafeRandom.cs (renamed from OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs)50
1 files changed, 25 insertions, 25 deletions
diff --git a/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs b/OpenSim/Framework/ThreadSafeRandom.cs
index 283fa2e..58853e6 100644
--- a/OpenSim/ApplicationPlugins/Rest/RestXmlWriter.cs
+++ b/OpenSim/Framework/ThreadSafeRandom.cs
@@ -25,48 +25,48 @@
25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. 25 * SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
26 */ 26 */
27 27
28using System.IO; 28using System;
29using System.Text;
30using System.Xml;
31 29
32namespace OpenSim.ApplicationPlugins.Rest 30namespace OpenSim.Framework
33{ 31{
34 public class RestXmlWriter: XmlTextWriter 32 /// <summary>
33 /// A thread-safe Random since the .NET version is not.
34 /// See http://msdn.microsoft.com/en-us/library/system.random%28v=vs.100%29.aspx
35 /// </summary>
36 public class ThreadSafeRandom : Random
35 { 37 {
36 private StringWriter m_sw = null; 38 public ThreadSafeRandom() : base() {}
37 39
38 public RestXmlWriter(StringWriter sw) : base(sw) 40 public ThreadSafeRandom(int seed): base (seed) {}
39 {
40 m_sw = sw;
41 Formatting = Formatting.Indented;
42 }
43
44 public RestXmlWriter(TextWriter textWriter) : base(textWriter)
45 {
46 }
47 41
48 public RestXmlWriter(Stream stream) 42 public override int Next()
49 : this(stream, Encoding.UTF8)
50 { 43 {
44 lock (this)
45 return base.Next();
51 } 46 }
52 47
53 public RestXmlWriter(Stream stream, Encoding enc) : base(stream, enc) 48 public override int Next(int maxValue)
54 { 49 {
50 lock (this)
51 return base.Next(maxValue);
55 } 52 }
56 53
57 public override void WriteStartDocument() 54 public override int Next(int minValue, int maxValue)
58 { 55 {
56 lock (this)
57 return base.Next(minValue, maxValue);
59 } 58 }
60 59
61 public override void WriteStartDocument(bool standalone) 60 public override void NextBytes(byte[] buffer)
62 { 61 {
62 lock (this)
63 base.NextBytes(buffer);
63 } 64 }
64 65
65 public override string ToString() 66 public override double NextDouble()
66 { 67 {
67 Flush(); 68 lock (this)
68 Close(); 69 return base.NextDouble();
69 return m_sw.ToString();
70 } 70 }
71 } 71 }
72} 72} \ No newline at end of file