Make sure that timer delay values are positive-definite, otherwise

user code that wants to use zero delay to mean "next frame" will get
stuck in an infinite loop.
This commit is contained in:
andy
2004-11-17 19:37:45 +00:00
parent ca50fe386d
commit ff10602c65

View File

@@ -4,6 +4,10 @@ void SGEventMgr::add(SGCallback* cb,
double interval, double delay,
bool repeat, bool simtime)
{
// Clamp the delay value to 1 usec, so that user code can use
// "zero" as a synonym for "next frame".
if(delay <= 0) delay = 0.000001;
SGTimer* t = new SGTimer;
t->interval = interval;
t->callback = cb;