From 6077bbda30bc9e5a16ec7b9c54fbdb5bbdccc11f Mon Sep 17 00:00:00 2001 From: Jeff Ames Date: Mon, 27 Apr 2009 03:22:31 +0000 Subject: Update svn properties. --- .../Minimodule/Interfaces/IMicrothreader.cs | 24 +++---- .../Scripting/Minimodule/MicroScheduler.cs | 76 ++++++++++---------- .../Test/Microthreads/MicrothreadSample.txt | 80 +++++++++++----------- 3 files changed, 90 insertions(+), 90 deletions(-) (limited to 'OpenSim') 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 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces -{ - public interface IMicrothreader - { - void Run(IEnumerable microthread); - } -} +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces +{ + public interface IMicrothreader + { + void Run(IEnumerable microthread); + } +} 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 @@ -using System; -using System.Collections; -using System.Collections.Generic; -using System.Text; -using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; - -namespace OpenSim.Region.OptionalModules.Scripting.Minimodule -{ - public class MicroScheduler : IMicrothreader - { - private readonly List m_threads = new List(); - - public void Run(IEnumerable microthread) - { - lock (m_threads) - m_threads.Add(microthread.GetEnumerator()); - } - - public void Tick(int count) - { - lock (m_threads) - { - if(m_threads.Count == 0) - return; - - int i = 0; - while (m_threads.Count > 0 && i < count) - { - i++; - bool running = m_threads[i%m_threads.Count].MoveNext(); - - if (!running) - m_threads.Remove(m_threads[i%m_threads.Count]); - } - } - } - } -} +using System; +using System.Collections; +using System.Collections.Generic; +using System.Text; +using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; + +namespace OpenSim.Region.OptionalModules.Scripting.Minimodule +{ + public class MicroScheduler : IMicrothreader + { + private readonly List m_threads = new List(); + + public void Run(IEnumerable microthread) + { + lock (m_threads) + m_threads.Add(microthread.GetEnumerator()); + } + + public void Tick(int count) + { + lock (m_threads) + { + if(m_threads.Count == 0) + return; + + int i = 0; + while (m_threads.Count > 0 && i < count) + { + i++; + bool running = m_threads[i%m_threads.Count].MoveNext(); + + if (!running) + m_threads.Remove(m_threads[i%m_threads.Count]); + } + } + } + } +} 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 @@ -//MRM:C# -using System.Collections; -using System.Collections.Generic; -using OpenSim.Region.OptionalModules.Scripting.Minimodule; - -namespace OpenSim -{ - class MiniModule : MRMBase - { - public microthreaded void MicroThreadFunction(string testparam) - { - Host.Object.Say("Hello " + testparam); - - relax; // the 'relax' keyword gives up processing time. - // and should be inserted before, after or in - // any computationally "heavy" zones. - - int c = 500; - while(c-- < 0) { - Host.Object.Say("C=" + c); - relax; // Putting 'relax' in microthreaded loops - // is an easy way to lower the CPU tax - // on your script. - } - - } - - public override void Start() - { - Host.Microthreads.Run( - MicroThreadFunction("World!") - ); - } - - public override void Stop() - { - - } - } -} +//MRM:C# +using System.Collections; +using System.Collections.Generic; +using OpenSim.Region.OptionalModules.Scripting.Minimodule; + +namespace OpenSim +{ + class MiniModule : MRMBase + { + public microthreaded void MicroThreadFunction(string testparam) + { + Host.Object.Say("Hello " + testparam); + + relax; // the 'relax' keyword gives up processing time. + // and should be inserted before, after or in + // any computationally "heavy" zones. + + int c = 500; + while(c-- < 0) { + Host.Object.Say("C=" + c); + relax; // Putting 'relax' in microthreaded loops + // is an easy way to lower the CPU tax + // on your script. + } + + } + + public override void Start() + { + Host.Microthreads.Run( + MicroThreadFunction("World!") + ); + } + + public override void Stop() + { + + } + } +} -- cgit v1.1