diff options
Diffstat (limited to '')
-rwxr-xr-x | OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | 55 |
1 files changed, 29 insertions, 26 deletions
diff --git a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs index 78d4ee9..3038915 100755 --- a/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs +++ b/OpenSim/Region/ScriptEngine/XEngine/XEngine.cs | |||
@@ -1024,18 +1024,15 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1024 | 1024 | ||
1025 | // m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID); | 1025 | // m_log.DebugFormat("[XEngine]: Added script {0} to compile queue", itemID); |
1026 | 1026 | ||
1027 | if (m_CurrentCompile == null) | 1027 | // NOTE: Although we use a lockless queue, the lock here |
1028 | // is required. It ensures that there are never two | ||
1029 | // compile threads running, which, due to a race | ||
1030 | // conndition, might otherwise happen | ||
1031 | // | ||
1032 | lock (m_CompileQueue) | ||
1028 | { | 1033 | { |
1029 | // NOTE: Although we use a lockless queue, the lock here | 1034 | if (m_CurrentCompile == null) |
1030 | // is required. It ensures that there are never two | 1035 | m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null); |
1031 | // compile threads running, which, due to a race | ||
1032 | // conndition, might otherwise happen | ||
1033 | // | ||
1034 | lock (m_CompileQueue) | ||
1035 | { | ||
1036 | if (m_CurrentCompile == null) | ||
1037 | m_CurrentCompile = m_ThreadPool.QueueWorkItem(DoOnRezScriptQueue, null); | ||
1038 | } | ||
1039 | } | 1036 | } |
1040 | } | 1037 | } |
1041 | } | 1038 | } |
@@ -1281,6 +1278,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1281 | } | 1278 | } |
1282 | } | 1279 | } |
1283 | 1280 | ||
1281 | // do not load a assembly on top of a lot of to release memory | ||
1282 | // also yield a bit | ||
1283 | // only if logins disable since causes a lot of rubber banding | ||
1284 | if(!m_Scene.LoginsEnabled) | ||
1285 | GC.Collect(2); | ||
1286 | |||
1284 | ScriptInstance instance = null; | 1287 | ScriptInstance instance = null; |
1285 | lock (m_Scripts) | 1288 | lock (m_Scripts) |
1286 | { | 1289 | { |
@@ -1288,26 +1291,27 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1288 | if ((!m_Scripts.ContainsKey(itemID)) || | 1291 | if ((!m_Scripts.ContainsKey(itemID)) || |
1289 | (m_Scripts[itemID].AssetID != assetID)) | 1292 | (m_Scripts[itemID].AssetID != assetID)) |
1290 | { | 1293 | { |
1291 | UUID appDomain = assetID; | 1294 | // UUID appDomain = assetID; |
1292 | 1295 | ||
1293 | if (part.ParentGroup.IsAttachment) | 1296 | // if (part.ParentGroup.IsAttachment) |
1294 | appDomain = part.ParentGroup.RootPart.UUID; | 1297 | // appDomain = part.ParentGroup.RootPart.UUID; |
1298 | UUID appDomain = part.ParentGroup.RootPart.UUID; | ||
1295 | 1299 | ||
1296 | if (!m_AppDomains.ContainsKey(appDomain)) | 1300 | if (!m_AppDomains.ContainsKey(appDomain)) |
1297 | { | 1301 | { |
1298 | try | 1302 | try |
1299 | { | 1303 | { |
1300 | AppDomainSetup appSetup = new AppDomainSetup(); | 1304 | AppDomain sandbox; |
1301 | appSetup.PrivateBinPath = Path.Combine( | 1305 | if (m_AppDomainLoading) |
1306 | { | ||
1307 | AppDomainSetup appSetup = new AppDomainSetup(); | ||
1308 | appSetup.PrivateBinPath = Path.Combine( | ||
1302 | m_ScriptEnginesPath, | 1309 | m_ScriptEnginesPath, |
1303 | m_Scene.RegionInfo.RegionID.ToString()); | 1310 | m_Scene.RegionInfo.RegionID.ToString()); |
1304 | 1311 | ||
1305 | Evidence baseEvidence = AppDomain.CurrentDomain.Evidence; | 1312 | Evidence baseEvidence = AppDomain.CurrentDomain.Evidence; |
1306 | Evidence evidence = new Evidence(baseEvidence); | 1313 | Evidence evidence = new Evidence(baseEvidence); |
1307 | 1314 | ||
1308 | AppDomain sandbox; | ||
1309 | if (m_AppDomainLoading) | ||
1310 | { | ||
1311 | sandbox = AppDomain.CreateDomain( | 1315 | sandbox = AppDomain.CreateDomain( |
1312 | m_Scene.RegionInfo.RegionID.ToString(), | 1316 | m_Scene.RegionInfo.RegionID.ToString(), |
1313 | evidence, appSetup); | 1317 | evidence, appSetup); |
@@ -1472,9 +1476,7 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1472 | startParam, postOnRez, | 1476 | startParam, postOnRez, |
1473 | m_MaxScriptQueue); | 1477 | m_MaxScriptQueue); |
1474 | 1478 | ||
1475 | if ( | 1479 | if(!instance.Load(scriptObj, coopSleepHandle, assemblyPath, |
1476 | !instance.Load( | ||
1477 | scriptObj, coopSleepHandle, assemblyPath, | ||
1478 | Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript)) | 1480 | Path.Combine(ScriptEnginePath, World.RegionInfo.RegionID.ToString()), stateSource, coopTerminationForThisScript)) |
1479 | return false; | 1481 | return false; |
1480 | 1482 | ||
@@ -1506,11 +1508,12 @@ namespace OpenSim.Region.ScriptEngine.XEngine | |||
1506 | m_PrimObjects[localID].Add(itemID); | 1508 | m_PrimObjects[localID].Add(itemID); |
1507 | } | 1509 | } |
1508 | 1510 | ||
1509 | if (!m_Assemblies.ContainsKey(assetID)) | ||
1510 | m_Assemblies[assetID] = assemblyPath; | ||
1511 | 1511 | ||
1512 | lock (m_AddingAssemblies) | 1512 | lock (m_AddingAssemblies) |
1513 | { | 1513 | { |
1514 | if (!m_Assemblies.ContainsKey(assetID)) | ||
1515 | m_Assemblies[assetID] = assemblyPath; | ||
1516 | |||
1514 | m_AddingAssemblies[assemblyPath]--; | 1517 | m_AddingAssemblies[assemblyPath]--; |
1515 | } | 1518 | } |
1516 | 1519 | ||