Signal trapping would be nice.
Moderator: Developers
Signal trapping would be nice.
Some signal trapping on POSIX systems would be nice, it currently will only respond to kill. This would be really useful to use ^C (Control+C) to close it from a shell. And should allow the use SIGTERM to close it when it hangs.
- penguinflyer5234
- Sheep (Developer)
- Posts: 3025
- Joined: Wed Jul 23, 2008 1:39 am
- Location: Best Southwest
-
- {]-[0{0|307 (Developer)
- Posts: 1864
- Joined: Wed Jul 23, 2008 4:22 am
- Location: Minnesota, USA
Actually, whatever SDL interprets as a kill signal will stop the program if it ever detects it. To get that to work properly, it must be done in a multi-threaded environment where the master thread iterates quickly and the heavy lifting is done by the worker threads...
This is practically impossible with SDL because of the way that the video is controlled. In Linux, it might be possible to spawn the entire "game" in a fork, in which case, it might be possible to grab various terminal and system flags and force the program to quit...
This is practically impossible with SDL because of the way that the video is controlled. In Linux, it might be possible to spawn the entire "game" in a fork, in which case, it might be possible to grab various terminal and system flags and force the program to quit...
- penguinflyer5234
- Sheep (Developer)
- Posts: 3025
- Joined: Wed Jul 23, 2008 1:39 am
- Location: Best Southwest
-
- {]-[0{0|307 (Developer)
- Posts: 1864
- Joined: Wed Jul 23, 2008 4:22 am
- Location: Minnesota, USA
I thought I had trapped the SDL_QUIT event, but apparently not...
In any case, this will not work if the program is trapped in an infinite loop somewhere. The best way to cure this is to have a multi-threaded system, but there are limits to the threading imposed by SDL (from the SDL documentation):
In any case, this will not work if the program is trapped in an infinite loop somewhere. The best way to cure this is to have a multi-threaded system, but there are limits to the threading imposed by SDL (from the SDL documentation):
- Don't call SDL video/event functions from separate
- Don't use any library functions in separate threads
- Don't perform any memory management in separate threads
- Lock global variables which may be accessed by multiple threads
- Never terminate threads, always set a flag and wait for them to quit
- Think very carefully about all possible ways your code may interact
- penguinflyer5234
- Sheep (Developer)
- Posts: 3025
- Joined: Wed Jul 23, 2008 1:39 am
- Location: Best Southwest
- penguinflyer5234
- Sheep (Developer)
- Posts: 3025
- Joined: Wed Jul 23, 2008 1:39 am
- Location: Best Southwest