1
0
Fork 0

FGNasalSys::setTimer: Timer names now identify the file and line number.

This identifies the function for the callback and allows for better debugging of
the sim and real time SGTimerQueues in the event manager.
This commit is contained in:
Edward d'Auvergne 2018-03-21 10:21:45 +01:00
parent 32d74493c4
commit 11f591261e

View file

@ -1373,13 +1373,19 @@ void FGNasalSys::setTimer(naContext c, int argc, naRef* args)
bool simtime = (argc > 2 && naTrue(args[2])) ? false : true;
// A unique name for the timer based on the file name and line number of the function.
std::string name = "NasalTimer-";
name.append(naStr_data(naGetSourceFile(c, 0)));
name.append(":");
name.append(std::to_string(naGetLine(c, 0)));
// Generate and register a C++ timer handler
NasalTimer* t = new NasalTimer;
t->handler = handler;
t->gcKey = gcSave(handler);
t->nasal = this;
globals->get_event_mgr()->addEvent("NasalTimer",
globals->get_event_mgr()->addEvent(name,
t, &NasalTimer::timerExpired,
delta.num, simtime);
}