Which events are raised when the game quits to OS

Started by theubie, September 21, 2016, 07:00:49 PM

Previous topic - Next topic

theubie

Ok, so I'm apparently blind, but I'm not seeing any events that are raised when Quit to OS (or hitting the X or Alt-F4 on windows systems, etc) is called.  I know a monobehavior from unity would get onApplicationQuit, but that isn't suited to what I'm dealing with.  I've got a process on a thread that is usually blocked, so quitting while it's active hangs everything up.  I'd like to find an event that I now is going to be raised so that I can add a handler that kills the blocking thread and thus allows the program to gracefully exit (the thread's reading from a stream, so there's 0 worry about data loss...so a forceful abort isn't going to be an issue.)

Anyone know of an event I can handle that would deal with this, or another direction to look for to resolve this issue?

theubie

Meh. I worked around the behavior by reading the entire stream and manually parsing it into individual lines rather than using the readline method from streamreader.  That allows me to use DataAvailable on the stream to prevent trying to read when there's nothing.  So, no blocking.  Still, would like to know an answer to the question though.

1000101

I haven't done a thorough check but I don't believe any system events are raised.  All class destructors will be called on all instantiated objects and any Unity events on GameObjects/MonoBehaviours will be called as appropriate but from what I can tell, that's it.
(2*b)||!(2*b) - That is the question.
There are 10 kinds of people in this world - those that understand binary and those that don't.

Powered By

theubie

This is correct.  As far as I can tell there isn't a single event created in Verse or Rimworld.  Would be nice to have some basic events raised on game state changes, for example.

RawCode

you will need some native code for this, start from ves_icall_System_Environment_Exit