diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/MicroScheduler.cs | 76 |
1 files changed, 38 insertions, 38 deletions
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 @@ | |||
1 | using System; | 1 | using System; |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using System.Text; | 4 | using System.Text; |
5 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; | 5 | using OpenSim.Region.OptionalModules.Scripting.Minimodule.Interfaces; |
6 | 6 | ||
7 | namespace OpenSim.Region.OptionalModules.Scripting.Minimodule | 7 | namespace 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 | } |