Added OpenSim.32BitLaunch.exe that can be used on 64-bit systems to run OpenSim in 32-bit mode.

Fixed ScriptEngine.Common startup problems.
ThreadPoolClientBranch
Tedd Hansen 2008-02-02 00:59:22 +00:00
parent a9b69f3880
commit 667197f24d
8 changed files with 44 additions and 32 deletions

View File

@ -28,6 +28,7 @@
using System.IO; using System.IO;
using libsecondlife; using libsecondlife;
using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Grid.ScriptServer.ScriptServer; using OpenSim.Grid.ScriptServer.ScriptServer;
@ -66,8 +67,8 @@ namespace OpenSim.Grid.ScriptServer
// Load DotNetEngine // Load DotNetEngine
Engine = ScriptEngines.LoadEngine("DotNetEngine"); Engine = ScriptEngines.LoadEngine("DotNetEngine");
IConfigSource config = null;
Engine.InitializeEngine(null, m_log, false, Engine.GetScriptManager()); Engine.InitializeEngine(null, null, m_log, false, Engine.GetScriptManager());
// Set up server // Set up server

View File

@ -75,7 +75,7 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
/// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads. /// Locking access to eventQueueThreads AND staticGlobalEventQueueThreads.
/// Note that this may or may not be a reference to a static object depending on PrivateRegionThreads config setting. /// Note that this may or may not be a reference to a static object depending on PrivateRegionThreads config setting.
/// </summary> /// </summary>
private object eventQueueThreadsLock; private object eventQueueThreadsLock = new object();
// Static objects for referencing the objects above if we don't have private threads: // Static objects for referencing the objects above if we don't have private threads:
internal static List<EventQueueThreadClass> staticEventQueueThreads; // A static reference used if we don't use private threads internal static List<EventQueueThreadClass> staticEventQueueThreads; // A static reference used if we don't use private threads
internal static object staticEventQueueThreadsLock; // Statick lock object reference for same reason internal static object staticEventQueueThreadsLock; // Statick lock object reference for same reason
@ -173,10 +173,11 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
{ {
m_ScriptEngine = _ScriptEngine; m_ScriptEngine = _ScriptEngine;
bool PrivateRegionThreads = m_ScriptEngine.ScriptConfigSource.GetBoolean("PrivateRegionThreads", false);
// Create thread pool list and lock object // Create thread pool list and lock object
// Determine from config if threads should be dedicated to regions or shared // Determine from config if threads should be dedicated to regions or shared
if (m_ScriptEngine.ScriptConfigSource.GetBoolean("PrivateRegionThreads", false)) if (PrivateRegionThreads)
{ {
// PRIVATE THREAD POOL PER REGION // PRIVATE THREAD POOL PER REGION
eventQueueThreads = new List<EventQueueThreadClass>(); eventQueueThreads = new List<EventQueueThreadClass>();
@ -185,13 +186,13 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
else else
{ {
// SHARED THREAD POOL // SHARED THREAD POOL
// Crate the objects in statics // Crate the static objects
if (staticEventQueueThreads == null) if (staticEventQueueThreads == null)
staticEventQueueThreads = new List<EventQueueThreadClass>(); staticEventQueueThreads = new List<EventQueueThreadClass>();
if (staticEventQueueThreadsLock == null) if (staticEventQueueThreadsLock == null)
staticEventQueueThreadsLock = new object(); staticEventQueueThreadsLock = new object();
// Create local reference to them // Now reference our locals to them
eventQueueThreads = staticEventQueueThreads; eventQueueThreads = staticEventQueueThreads;
eventQueueThreadsLock = staticEventQueueThreadsLock; eventQueueThreadsLock = staticEventQueueThreadsLock;
} }
@ -228,22 +229,25 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
private void Stop() private void Stop()
{ {
if (eventQueueThreadsLock != null && eventQueueThreads != null)
// Kill worker threads
lock (eventQueueThreadsLock)
{ {
foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads) // Kill worker threads
lock (eventQueueThreadsLock)
{ {
AbortThreadClass(EventQueueThread); foreach (EventQueueThreadClass EventQueueThread in eventQueueThreads)
{
AbortThreadClass(EventQueueThread);
}
eventQueueThreads.Clear();
staticGlobalEventQueueThreads.Clear();
} }
eventQueueThreads.Clear();
staticGlobalEventQueueThreads.Clear();
}
// Remove all entries from our event queue
lock (queueLock)
{
eventQueue.Clear();
} }
// Remove all entries from our event queue
lock (queueLock)
{
eventQueue.Clear();
}
} }
#endregion #endregion

View File

@ -86,13 +86,18 @@ namespace OpenSim.Region.ScriptEngine.Common.ScriptEngineBase
get { return m_log; } get { return m_log; }
} }
public void InitializeEngine(Scene Sceneworld, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager) public void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool HookUpToServer, ScriptManager newScriptManager)
{ {
World = Sceneworld; World = Sceneworld;
m_log = logger; m_log = logger;
ScriptConfigSource = ConfigSource.Configs[ScriptEngineName]; ConfigSource = config;
Log.Verbose(ScriptEngineName, "ScriptEngine initializing");
Log.Verbose(ScriptEngineName, "Reading configuration from config section \"" + ScriptEngineName + "\"");
Log.Verbose(ScriptEngineName, "DotNet & LSL ScriptEngine initializing"); // Make sure we have config
if (ConfigSource.Configs[ScriptEngineName] == null)
ConfigSource.AddConfig(ScriptEngineName);
ScriptConfigSource = ConfigSource.Configs[ScriptEngineName];
//m_logger.Status(ScriptEngineName, "InitializeEngine"); //m_logger.Status(ScriptEngineName, "InitializeEngine");

View File

@ -27,6 +27,7 @@
*/ */
using libsecondlife; using libsecondlife;
using Nini.Config;
using OpenSim.Framework; using OpenSim.Framework;
using OpenSim.Framework.Console; using OpenSim.Framework.Console;
using OpenSim.Region.Environment.Scenes; using OpenSim.Region.Environment.Scenes;
@ -81,7 +82,7 @@ namespace OpenSim.Region.ScriptEngine.Common
public interface ScriptEngine public interface ScriptEngine
{ {
RemoteEvents EventManager(); RemoteEvents EventManager();
void InitializeEngine(Scene Sceneworld, LogBase logger, bool DontHookUp, ScriptManager newScriptManager); void InitializeEngine(Scene Sceneworld, IConfigSource config, LogBase logger, bool DontHookUp, ScriptManager newScriptManager);
ScriptManager GetScriptManager(); ScriptManager GetScriptManager();
} }

View File

@ -40,7 +40,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
public override void Initialise(Scene scene, IConfigSource config) public override void Initialise(Scene scene, IConfigSource config)
{ {
ConfigSource = config; ConfigSource = config;
InitializeEngine(scene, MainLog.Instance, true, GetScriptManager()); InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager());
} }
public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager()

View File

@ -41,7 +41,6 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
: base(scriptEngine) : base(scriptEngine)
{ {
base.m_scriptEngine = scriptEngine; base.m_scriptEngine = scriptEngine;
} }
// KEEP TRACK OF SCRIPTS <int id, whatever script> // KEEP TRACK OF SCRIPTS <int id, whatever script>
@ -55,7 +54,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
public override void _StartScript(uint localID, LLUUID itemID, string Script) public override void _StartScript(uint localID, LLUUID itemID, string Script)
{ {
//IScriptHost root = host.GetRoot(); //IScriptHost root = host.GetRoot();
Console.WriteLine("ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID); m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "ScriptManager StartScript: localID: " + localID + ", itemID: " + itemID);
// We will initialize and start the script. // We will initialize and start the script.
// It will be up to the script itself to hook up the correct events. // It will be up to the script itself to hook up the correct events.
@ -77,7 +76,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource); CompiledScript = m_scriptEngine.m_AppDomainManager.LoadScript(ScriptSource);
#if DEBUG #if DEBUG
Console.WriteLine("Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before); m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Script " + itemID + " occupies {0} bytes", GC.GetTotalMemory(true) - before);
#endif #endif
CompiledScript.Source = Script; CompiledScript.Source = Script;
@ -110,8 +109,8 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
} }
catch (Exception e2) catch (Exception e2)
{ {
m_scriptEngine.Log.Error("ScriptEngine", "Error displaying error in-world: " + e2.ToString()); m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Error displaying error in-world: " + e2.ToString());
m_scriptEngine.Log.Error("ScriptEngine", m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName,
"Errormessage: Error compiling script:\r\n" + e.Message.ToString()); "Errormessage: Error compiling script:\r\n" + e.Message.ToString());
} }
} }
@ -120,8 +119,9 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
public override void _StopScript(uint localID, LLUUID itemID) public override void _StopScript(uint localID, LLUUID itemID)
{ {
// Stop script // Stop script
Console.WriteLine("Stop script localID: " + localID + " LLUID: " + itemID.ToString()); #if DEBUG
m_scriptEngine.Log.Debug(m_scriptEngine.ScriptEngineName, "Stop script localID: " + localID + " LLUID: " + itemID.ToString());
#endif
// Stop long command on script // Stop long command on script
m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID); m_scriptEngine.m_ASYNCLSLCommandManager.RemoveScript(localID, itemID);
@ -147,7 +147,7 @@ namespace OpenSim.Region.ScriptEngine.DotNetEngine
} }
catch (Exception e) catch (Exception e)
{ {
Console.WriteLine("Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() + m_scriptEngine.Log.Error(m_scriptEngine.ScriptEngineName, "Exception stopping script localID: " + localID + " LLUID: " + itemID.ToString() +
": " + e.ToString()); ": " + e.ToString());
} }
} }

View File

@ -44,7 +44,7 @@ namespace OpenSim.Region.ScriptEngine.LSOEngine
// We need to override a few things for our DotNetEngine // We need to override a few things for our DotNetEngine
public override void Initialise(Scene scene, IConfigSource config) public override void Initialise(Scene scene, IConfigSource config)
{ {
InitializeEngine(scene, MainLog.Instance, true, GetScriptManager()); InitializeEngine(scene, config, MainLog.Instance, true, GetScriptManager());
} }
public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager() public override OpenSim.Region.ScriptEngine.Common.ScriptEngineBase.ScriptManager _GetScriptManager()

View File

@ -1280,6 +1280,7 @@
<Reference name="libsecondlife.dll"/> <Reference name="libsecondlife.dll"/>
<Reference name="Axiom.MathLib.dll" localCopy="false"/> <Reference name="Axiom.MathLib.dll" localCopy="false"/>
<Reference name="XMLRPC.dll"/> <Reference name="XMLRPC.dll"/>
<Reference name="Nini.dll" />
<Files> <Files>
<Match pattern="*.cs" recurse="true"/> <Match pattern="*.cs" recurse="true"/>