aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/OptionalModules/Scripting
diff options
context:
space:
mode:
authorJeff Ames2009-04-27 03:22:31 +0000
committerJeff Ames2009-04-27 03:22:31 +0000
commit6077bbda30bc9e5a16ec7b9c54fbdb5bbdccc11f (patch)
tree00f525b826cc627e785ec8842da5001f21c650c2 /OpenSim/Region/OptionalModules/Scripting
parentGetting rid of -hypergrid=true on the command line. This config now goes insi... (diff)
downloadopensim-SC_OLD-6077bbda30bc9e5a16ec7b9c54fbdb5bbdccc11f.zip
opensim-SC_OLD-6077bbda30bc9e5a16ec7b9c54fbdb5bbdccc11f.tar.gz
opensim-SC_OLD-6077bbda30bc9e5a16ec7b9c54fbdb5bbdccc11f.tar.bz2
opensim-SC_OLD-6077bbda30bc9e5a16ec7b9c54fbdb5bbdccc11f.tar.xz
Update svn properties.
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting')
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs24
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs76
-rw-r--r--OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt80
3 files changed, 90 insertions, 90 deletions
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs
index 22d3a99..5e187a5 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Interfaces/IMicrothreader.cs
@@ -1,12 +1,12 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5 5
6namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces 6namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces
7{ 7{
8 public interface IMicrothreader 8 public interface IMicrothreader
9 { 9 {
10 void Run(IEnumerable microthread); 10 void Run(IEnumerable microthread);
11 } 11 }
12} 12}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs
index a5da87b..500c5bf 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs
@@ -1,38 +1,38 @@
1using System; 1using System;
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using System.Text; 4using System.Text;
5using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; 5using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces;
6 6
7namespace OpenSim.Region.OptionalModules.Scripting.Minimodule 7namespace OpenSim.Region.OptionalModules.Scripting.Minimodule
8{ 8{
9 public class MicroScheduler : IMicrothreader 9 public class MicroScheduler : IMicrothreader
10 { 10 {
11 private readonly List<IEnumerator> m_threads = new List<IEnumerator>(); 11 private readonly List<IEnumerator> m_threads = new List<IEnumerator>();
12 12
13 public void Run(IEnumerable microthread) 13 public void Run(IEnumerable microthread)
14 { 14 {
15 lock (m_threads) 15 lock (m_threads)
16 m_threads.Add(microthread.GetEnumerator()); 16 m_threads.Add(microthread.GetEnumerator());
17 } 17 }
18 18
19 public void Tick(int count) 19 public void Tick(int count)
20 { 20 {
21 lock (m_threads) 21 lock (m_threads)
22 { 22 {
23 if(m_threads.Count == 0) 23 if(m_threads.Count == 0)
24 return; 24 return;
25 25
26 int i = 0; 26 int i = 0;
27 while (m_threads.Count > 0 && i < count) 27 while (m_threads.Count > 0 && i < count)
28 { 28 {
29 i++; 29 i++;
30 bool running = m_threads[i%m_threads.Count].MoveNext(); 30 bool running = m_threads[i%m_threads.Count].MoveNext();
31 31
32 if (!running) 32 if (!running)
33 m_threads.Remove(m_threads[i%m_threads.Count]); 33 m_threads.Remove(m_threads[i%m_threads.Count]);
34 } 34 }
35 } 35 }
36 } 36 }
37 } 37 }
38} 38}
diff --git a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt
index dc15c47..d2c204a 100644
--- a/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt
+++ b/OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt
@@ -1,40 +1,40 @@
1//MRM:C# 1//MRM:C#
2using System.Collections; 2using System.Collections;
3using System.Collections.Generic; 3using System.Collections.Generic;
4using OpenSim.Region.OptionalModules.Scripting.Minimodule; 4using OpenSim.Region.OptionalModules.Scripting.Minimodule;
5 5
6namespace OpenSim 6namespace OpenSim
7{ 7{
8 class MiniModule : MRMBase 8 class MiniModule : MRMBase
9 { 9 {
10 public microthreaded void MicroThreadFunction(string testparam) 10 public microthreaded void MicroThreadFunction(string testparam)
11 { 11 {
12 Host.Object.Say("Hello " + testparam); 12 Host.Object.Say("Hello " + testparam);
13 13
14 relax; // the 'relax' keyword gives up processing time. 14 relax; // the 'relax' keyword gives up processing time.
15 // and should be inserted before, after or in 15 // and should be inserted before, after or in
16 // any computationally "heavy" zones. 16 // any computationally "heavy" zones.
17 17
18 int c = 500; 18 int c = 500;
19 while(c-- < 0) { 19 while(c-- < 0) {
20 Host.Object.Say("C=" + c); 20 Host.Object.Say("C=" + c);
21 relax; // Putting 'relax' in microthreaded loops 21 relax; // Putting 'relax' in microthreaded loops
22 // is an easy way to lower the CPU tax 22 // is an easy way to lower the CPU tax
23 // on your script. 23 // on your script.
24 } 24 }
25 25
26 } 26 }
27 27
28 public override void Start() 28 public override void Start()
29 { 29 {
30 Host.Microthreads.Run( 30 Host.Microthreads.Run(
31 MicroThreadFunction("World!") 31 MicroThreadFunction("World!")
32 ); 32 );
33 } 33 }
34 34
35 public override void Stop() 35 public override void Stop()
36 { 36 {
37 37
38 } 38 }
39 } 39 }
40} 40}