aboutsummaryrefslogtreecommitdiffstatshomepage
path: root/OpenSim/Region
diff options
context:
space:
mode:
authorMelanie2013-02-12 22:20:16 +0100
committerMelanie2013-02-12 22:20:16 +0100
commitd5b401a478d9756bd5ce0185896262f6985d2ade (patch)
tree023c89bd52f4b29979afd090b2957ebf681c63b8 /OpenSim/Region
parentRevert "Push updates from keyframe directly to the front of the output queue ... (diff)
downloadopensim-SC_OLD-d5b401a478d9756bd5ce0185896262f6985d2ade.zip
opensim-SC_OLD-d5b401a478d9756bd5ce0185896262f6985d2ade.tar.gz
opensim-SC_OLD-d5b401a478d9756bd5ce0185896262f6985d2ade.tar.bz2
opensim-SC_OLD-d5b401a478d9756bd5ce0185896262f6985d2ade.tar.xz
Revert "Make keyframes use the sim's frame timer"
This reverts commit e85a6237bfc0f00de4a183e29e515fa5baf1aa7f.
Diffstat (limited to 'OpenSim/Region')
-rw-r--r--OpenSim/Region/Framework/Scenes/KeyframeMotion.cs23
1 files changed, 15 insertions, 8 deletions
diff --git a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
index 75b16dc..6dc6504 100644
--- a/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
+++ b/OpenSim/Region/Framework/Scenes/KeyframeMotion.cs
@@ -27,11 +27,12 @@ namespace OpenSim.Region.Framework.Scenes
27 private static Dictionary<Scene, KeyframeTimer>m_timers = 27 private static Dictionary<Scene, KeyframeTimer>m_timers =
28 new Dictionary<Scene, KeyframeTimer>(); 28 new Dictionary<Scene, KeyframeTimer>();
29 29
30 private Timer m_timer;
30 private Dictionary<KeyframeMotion, object> m_motions = new Dictionary<KeyframeMotion, object>(); 31 private Dictionary<KeyframeMotion, object> m_motions = new Dictionary<KeyframeMotion, object>();
31 private object m_lockObject = new object(); 32 private object m_lockObject = new object();
33 private object m_timerLock = new object();
32 private const double m_tickDuration = 50.0; 34 private const double m_tickDuration = 50.0;
33 private Scene m_scene; 35 private Scene m_scene;
34 private int m_prevTick;
35 36
36 public double TickDuration 37 public double TickDuration
37 { 38 {
@@ -40,18 +41,20 @@ namespace OpenSim.Region.Framework.Scenes
40 41
41 public KeyframeTimer(Scene scene) 42 public KeyframeTimer(Scene scene)
42 { 43 {
43 m_prevTick = Util.EnvironmentTickCount(); 44 m_timer = new Timer();
45 m_timer.Interval = TickDuration;
46 m_timer.AutoReset = true;
47 m_timer.Elapsed += OnTimer;
44 48
45 m_scene = scene; 49 m_scene = scene;
46 50
47 m_scene.EventManager.OnFrame += OnTimer; 51 m_timer.Start();
48 } 52 }
49 53
50 private void OnTimer() 54 private void OnTimer(object sender, ElapsedEventArgs ea)
51 { 55 {
52 int thisTick = Util.EnvironmentTickCount(); 56 if (!Monitor.TryEnter(m_timerLock))
53 int tickdiff = Util.EnvironmentTickCountSubtract(thisTick, m_prevTick); 57 return;
54 m_prevTick = thisTick;
55 58
56 try 59 try
57 { 60 {
@@ -66,7 +69,7 @@ namespace OpenSim.Region.Framework.Scenes
66 { 69 {
67 try 70 try
68 { 71 {
69 m.OnTimer(tickdiff); 72 m.OnTimer(TickDuration);
70 } 73 }
71 catch (Exception inner) 74 catch (Exception inner)
72 { 75 {
@@ -78,6 +81,10 @@ namespace OpenSim.Region.Framework.Scenes
78 { 81 {
79 // Keep running no matter what 82 // Keep running no matter what
80 } 83 }
84 finally
85 {
86 Monitor.Exit(m_timerLock);
87 }
81 } 88 }
82 89
83 public static void Add(KeyframeMotion motion) 90 public static void Add(KeyframeMotion motion)