Jump to content
The simFlight Network Forums

Recommended Posts

Posted

I have a LUA script for my aircraft that runs and handles custom actions for button presses. I've registered a shutdown handler to run when the sim shuts down, and it is being called correctly. The last three lines in the shutdown handler are as follows:

event.cancel("HandleShutdown")
ipc.log("TFDi MD-11 Button Handler shutdown (" .. btnCount .. " buttons, " .. updCount .. " LED updates)")
ipc.exit()

When P3Dv5 shuts down, the handler is called correctly, and I can see the last log line execute. However, in the log I see a 2150ms wait time, then the LUA thread gets killed. Should it not be dead already given the ipc.exit()?

Full FSUIPC log attached.

Cheers

 

FSUIPC6.log

Posted

An ipc.exit() call will not do anything when called in a shutdown handler as the thread is already exiting.
A shutdown handler is only needed to close any opened resources really - files, ports (com), pipes, etc. No need to cancel events.

John

Posted

That's helpful. Is this part of the log expected:

   662000 Lua threads being terminated:
   662000       1 = "D:\Program Files\FSUIPC6\tfdimd11.lua"
   662000 LUA: "D:\Program Files\FSUIPC6\tfdimd11.lua": killed

It feels like an unclean shutdown.

Cheers

Posted
31 minutes ago, Luke Kolin said:

It feels like an unclean shutdown.

It is expected (if the lua thread does not exit of its own accord in the required time limit) and it is forced / unclean shutdown, but nothing to worry about. You can try increasing the TimeForLuaClosing ini parameter, but this may not help either.
But it really is nothing to worry about. A lua termination handler should only be used to free any windows resources acquired.

 

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...

Important Information

By using this site, you agree to our Terms of Use. Guidelines Privacy Policy We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.