Best way to ensure threads finish in GUI application?

Erich Rast <[email protected]>
Newsgroups gmane.comp.lang.racket.user,gmane.lisp.scheme.plt
Message-ID <20170131132303.7ac583b3@nemo-pny>
Hi,

I was wondering what's the best way to ensure that threads end
when a gui application is shut down, which synchronization mechanism I
should use and which kind of program terminations would be handled
gracefully  by this.

I'm planning on delaying certain sqlite transactions in threads,
since doing them immediately when the user interacts with the GUI does
not work well. AFAIK, sqlite is ACID-compliant, so db consistency
should not be a concern, but I still need to figure out which mechanism
to use for ensuring that the main thread waits for the remaining
threads to finish, and under which conditions it will fail. I've read
about custodians and application-quit-handler. Should I use the latter?
Which timeout is "safe" on which platform? (E.g. Windows waits for
applications to finish before it shuts down, but not indefinitely, and
how about Linux and OSX?)

Related to that, does application-quit-handler capture signals on
Linux, and if so, which ones, and/or is there a way to install signal
handlers in Racket?

Sorry for posing so many questions at once. I just wonder what the
practice is for this common scenario. Thanks in advance for any replies!

Best,

Erich

-- 
You received this message because you are subscribed to the Google Groups "Racket Users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to racket-users+unsubscribe-/JYPxA39Uh5TLH3MbocFF+G/[email protected]
For more options, visit https://groups.google.com/d/optout.
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.