diff options
Diffstat (limited to 'OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt')
-rw-r--r-- | OpenSim/Region/OptionalModules/Scripting/Minimodule/Test/Microthreads/MicrothreadSample.txt | 80 |
1 files changed, 40 insertions, 40 deletions
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# |
2 | using System.Collections; | 2 | using System.Collections; |
3 | using System.Collections.Generic; | 3 | using System.Collections.Generic; |
4 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; | 4 | using OpenSim.Region.OptionalModules.Scripting.Minimodule; |
5 | 5 | ||
6 | namespace OpenSim | 6 | namespace 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 | } |