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:
parent
32d74493c4
commit
11f591261e
1 changed files with 7 additions and 1 deletions
|
@ -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);
|
||||
}
|
||||
|
|
Loading…
Add table
Reference in a new issue