From e6615a193dcfe36238708febdeda34b03e1bbf1e Mon Sep 17 00:00:00 2001 From: UbitUmarov Date: Tue, 4 Sep 2018 22:19:30 +0100 Subject: a few changes to ScriptSleep() functions --- .../Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs | 11 ++++------- .../Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs | 9 ++++++--- OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs | 4 ++-- 3 files changed, 12 insertions(+), 12 deletions(-) diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs index 47610a1..6ffc0fc 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/LSL_Api.cs @@ -443,8 +443,8 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected virtual void ScriptSleep(int delay) { - delay = (int)((float)delay * m_ScriptDelayFactor); - if (delay == 0) + delay = (int)(delay * m_ScriptDelayFactor); + if (delay < 10) return; Sleep(delay); @@ -453,12 +453,9 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected virtual void Sleep(int delay) { if (m_item == null) // Some unit tests don't set this - { Thread.Sleep(delay); - return; - } - - m_ScriptEngine.SleepScript(m_item.ItemID, delay); + else + m_ScriptEngine.SleepScript(m_item.ItemID, delay); } /// diff --git a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs index c4f2ef7..62729b3 100644 --- a/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs +++ b/OpenSim/Region/ScriptEngine/Shared/Api/Implementation/OSSL_Api.cs @@ -485,10 +485,13 @@ namespace OpenSim.Region.ScriptEngine.Shared.Api protected void ScriptSleep(int delay) { - delay = (int)((float)delay * m_ScriptDelayFactor); - if (delay == 0) + delay = (int)(delay * m_ScriptDelayFactor); + if (delay < 10) return; - System.Threading.Thread.Sleep(delay); + if(m_item != null) + m_ScriptEngine.SleepScript(m_item.ItemID, delay); + else + Thread.Sleep(delay); } public LSL_Integer osSetTerrainHeight(int x, int y, double val) diff --git a/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs b/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs index 332085f..b6f8874 100644 --- a/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs +++ b/OpenSim/Region/ScriptEngine/YEngine/XMRInstBackend.cs @@ -61,8 +61,8 @@ namespace OpenSim.Region.ScriptEngine.Yengine protected override void ScriptSleep(int ms) { - ms = (int)((float)ms * m_ScriptDelayFactor); - if (ms == 0) + ms = (int)(ms * m_ScriptDelayFactor); + if (ms < 10) return; inst.Sleep(ms); -- cgit v1.1