aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region/ScriptEngine/XMREngine
diff options
context:
space:
mode:
authorUbitUmarov2018-02-03 19:34:17 +0000
committerUbitUmarov2018-02-03 19:34:17 +0000
commite7e8a7ab4de8f29a3b646574033e4d8117cc7cc0 (patch)
treeae2abbcd7f7d084b465df22ac6807c356296a918 /OpenSim/Region/ScriptEngine/XMREngine
parentXMR: there is no need for a slice thread, it also causes timing issues; Below... (diff)
downloadopensim-SC-e7e8a7ab4de8f29a3b646574033e4d8117cc7cc0.zip
opensim-SC-e7e8a7ab4de8f29a3b646574033e4d8117cc7cc0.tar.gz
opensim-SC-e7e8a7ab4de8f29a3b646574033e4d8117cc7cc0.tar.bz2
opensim-SC-e7e8a7ab4de8f29a3b646574033e4d8117cc7cc0.tar.xz
just DIE damm thread (recent monos issue)
Diffstat (limited to 'OpenSim/Region/ScriptEngine/XMREngine')
-rw-r--r--OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs32
-rw-r--r--OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs3
2 files changed, 23 insertions, 12 deletions
diff --git a/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs b/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs
index 5889451..51c7618 100644
--- a/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs
+++ b/OpenSim/Region/ScriptEngine/XMREngine/XMREngine.cs
@@ -682,25 +682,33 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
682 * one to finish (ie, script gets to CheckRun() call). 682 * one to finish (ie, script gets to CheckRun() call).
683 */ 683 */
684 m_Exiting = true; 684 m_Exiting = true;
685 for (int i = 0; i < numThreadScriptWorkers; i ++) { 685 for (int i = 0; i < numThreadScriptWorkers; i ++)
686 {
686 XMRScriptThread scriptThread = m_ScriptThreads[i]; 687 XMRScriptThread scriptThread = m_ScriptThreads[i];
687 if (scriptThread != null) { 688 if (scriptThread != null)
689 {
688 scriptThread.Terminate(); 690 scriptThread.Terminate();
689 m_ScriptThreads[i] = null; 691 m_ScriptThreads[i] = null;
690 } 692 }
691 } 693 }
692 if (m_SleepThread != null) { 694
693 lock (m_SleepQueue) { 695 if (m_SleepThread != null)
696 {
697 lock (m_SleepQueue)
698 {
694 Monitor.PulseAll (m_SleepQueue); 699 Monitor.PulseAll (m_SleepQueue);
695 } 700 }
696 m_SleepThread.Join(); 701 if(!m_SleepThread.Join(250))
702 m_SleepThread.Abort();
697 m_SleepThread = null; 703 m_SleepThread = null;
698 } 704 }
699 if (m_SliceThread != null) { 705/*
706 if (m_SliceThread != null)
707 {
700 m_SliceThread.Join(); 708 m_SliceThread.Join();
701 m_SliceThread = null; 709 m_SliceThread = null;
702 } 710 }
703 711*/
704 m_Scene.EventManager.OnFrame -= OnFrame; 712 m_Scene.EventManager.OnFrame -= OnFrame;
705 m_Scene.EventManager.OnRezScript -= OnRezScript; 713 m_Scene.EventManager.OnRezScript -= OnRezScript;
706 m_Scene.EventManager.OnRemoveScript -= OnRemoveScript; 714 m_Scene.EventManager.OnRemoveScript -= OnRemoveScript;
@@ -1759,29 +1767,30 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
1759 /** 1767 /**
1760 * @brief Thread that runs a time slicer. 1768 * @brief Thread that runs a time slicer.
1761 */ 1769 */
1770/*
1762 private void RunSliceThread() 1771 private void RunSliceThread()
1763 { 1772 {
1764 int ms = m_Config.GetInt ("TimeSlice", 50); 1773 int ms = m_Config.GetInt ("TimeSlice", 50);
1765 while (!m_Exiting) { 1774 while (!m_Exiting) {
1766 UpdateMyThread (); 1775 UpdateMyThread ();
1767 1776*/
1768 /* 1777 /*
1769 * Let script run for a little bit. 1778 * Let script run for a little bit.
1770 */ 1779 */
1771 System.Threading.Thread.Sleep (ms); 1780// System.Threading.Thread.Sleep (ms);
1772 1781
1773 /* 1782 /*
1774 * If some script is running, flag it to suspend 1783 * If some script is running, flag it to suspend
1775 * next time it calls CheckRun(). 1784 * next time it calls CheckRun().
1776 */ 1785 */
1777 for (int i = 0; i < numThreadScriptWorkers; i ++) { 1786/* for (int i = 0; i < numThreadScriptWorkers; i ++) {
1778 XMRScriptThread st = m_ScriptThreads[i]; 1787 XMRScriptThread st = m_ScriptThreads[i];
1779 if (st != null) st.TimeSlice(); 1788 if (st != null) st.TimeSlice();
1780 } 1789 }
1781 } 1790 }
1782 MyThreadExiting (); 1791 MyThreadExiting ();
1783 } 1792 }
1784 1793*/
1785 public void Suspend(UUID itemID, int ms) 1794 public void Suspend(UUID itemID, int ms)
1786 { 1795 {
1787 XMRInstance instance = GetInstance (itemID); 1796 XMRInstance instance = GetInstance (itemID);
@@ -1960,6 +1969,7 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
1960 Thread thread = new Thread (start); 1969 Thread thread = new Thread (start);
1961 thread.Name = name; 1970 thread.Name = name;
1962 thread.Priority = priority; 1971 thread.Priority = priority;
1972 thread.IsBackground = true;
1963 thread.Start (); 1973 thread.Start ();
1964 1974
1965 Watchdog.ThreadWatchdogInfo info = new Watchdog.ThreadWatchdogInfo (thread, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS, name); 1975 Watchdog.ThreadWatchdogInfo info = new Watchdog.ThreadWatchdogInfo (thread, Watchdog.DEFAULT_WATCHDOG_TIMEOUT_MS, name);
diff --git a/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs b/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs
index a1238db..ddb3698 100644
--- a/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs
+++ b/OpenSim/Region/ScriptEngine/XMREngine/XMRScriptThread.cs
@@ -105,7 +105,8 @@ namespace OpenSim.Region.ScriptEngine.XMREngine
105 { 105 {
106 m_Exiting = true; 106 m_Exiting = true;
107 WakeUpScriptThread(); 107 WakeUpScriptThread();
108 thd.Join(); 108 if(!thd.Join(250))
109 thd.Abort();
109 lock (m_AllThreads) 110 lock (m_AllThreads)
110 m_AllThreads.Remove (thd); 111 m_AllThreads.Remove (thd);
111 112