aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
diff options
context:
space:
mode:
Diffstat (limited to 'OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs')
-rw-r--r--OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs39
1 files changed, 34 insertions, 5 deletions
diff --git a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
index 33e95d3..77c859f 100644
--- a/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
+++ b/OpenSim/Region/ScriptEngine/DotNetEngine/AppDomainManager.cs
@@ -5,6 +5,10 @@ using System.Reflection;
5using System.Threading; 5using System.Threading;
6using System.Runtime.Remoting; 6using System.Runtime.Remoting;
7using System.IO; 7using System.IO;
8using OpenSim.Region.Environment.Scenes;
9using OpenSim.Region.Environment.Scenes.Scripting;
10using OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL;
11using OpenSim.Region.ScriptEngine.Common;
8 12
9namespace OpenSim.Region.ScriptEngine.DotNetEngine 13namespace OpenSim.Region.ScriptEngine.DotNetEngine
10{ 14{
@@ -51,7 +55,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
51 /// Find a free AppDomain, creating one if necessary 55 /// Find a free AppDomain, creating one if necessary
52 /// </summary> 56 /// </summary>
53 /// <returns>Free AppDomain</returns> 57 /// <returns>Free AppDomain</returns>
54 internal AppDomain GetFreeAppDomain() 58 private AppDomainStructure GetFreeAppDomain()
55 { 59 {
56 FreeAppDomains(); 60 FreeAppDomains();
57 lock(GetLock) { 61 lock(GetLock) {
@@ -78,9 +82,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
78 // - We assume that every time someone wants an AppDomain they will load into it 82 // - We assume that every time someone wants an AppDomain they will load into it
79 // if this assumption is wrong we end up with a miscount and will never unload it. 83 // if this assumption is wrong we end up with a miscount and will never unload it.
80 // 84 //
81 CurrentAD.ScriptsLoaded++; 85
82 // Return AppDomain 86 // Return AppDomain
83 return CurrentAD.CurrentAppDomain; 87 return CurrentAD;
84 } // lock 88 } // lock
85 } 89 }
86 90
@@ -136,13 +140,37 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
136 } // foreach 140 } // foreach
137 } // lock 141 } // lock
138 } 142 }
143
144
145
146 public OpenSim.Region.ScriptEngine.DotNetEngine.Compiler.LSL.LSL_BaseClass LoadScript(string FileName, IScriptHost host)
147 {
148 //LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CreateInstanceAndUnwrap(FileName, "SecondLife.Script");
149 //Console.WriteLine("Base directory: " + AppDomain.CurrentDomain.BaseDirectory);
150 // * Find next available AppDomain to put it in
151 AppDomainStructure FreeAppDomain = GetFreeAppDomain();
152
153
154 LSL_BaseClass mbrt = (LSL_BaseClass)FreeAppDomain.CurrentAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script");
155 //LSL_BuiltIn_Commands_Interface mbrt = (LSL_BuiltIn_Commands_Interface)FreeAppDomain.CreateInstanceFromAndUnwrap(FileName, "SecondLife.Script");
156 //Type mytype = mbrt.GetType();
157 //Console.WriteLine("is proxy={0}", RemotingServices.IsTransparentProxy(mbrt));
158
159 FreeAppDomain.ScriptsLoaded++;
160
161 //mbrt.Start();
162 return mbrt;
163 //return (LSL_BaseClass)mbrt;
164
165 }
166
139 167
140 /// <summary> 168 /// <summary>
141 /// Increase "dead script" counter for an AppDomain 169 /// Increase "dead script" counter for an AppDomain
142 /// </summary> 170 /// </summary>
143 /// <param name="ad"></param> 171 /// <param name="ad"></param>
144 [Obsolete("Needs optimizing!!!")] 172 [Obsolete("Needs fixing!!!")]
145 public void StopScriptInAppDomain(AppDomain ad) 173 public void StopScript(AppDomain ad)
146 { 174 {
147 lock (FreeLock) 175 lock (FreeLock)
148 { 176 {
@@ -170,5 +198,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
170 } // lock 198 } // lock
171 } 199 }
172 200
201
173 } 202 }
174} 203}