core: Refactor MainLoop handling
core: Refactor MainLoop handling

Previously `Display.teardown` relied on the EOS message handler quitting
the mainloop to signal that EOS had occurred.  Instead we use an explicit
`threading.Event` object to communicate this.  This is much cleaner as it
will allow us to decouple the lifetime and running of the main loop and the
main loop thread from the working of the `Display` objects.

This will also be useful in the future for splitting the sink pipeline out
of the Display class as required for proper librification.

stb-tester/stb-tester,martynjarvis/stb-tester,martynjarvis/stb-tester,stb-tester/stb-tester,LewisHaley/stb-tester,martynjarvis/stb-tester,martynjarvis/stb-tester,LewisHaley/stb-tester,martynjarvis/stb-tester,LewisHaley/stb-tester,LewisHaley/stb-tester,martynjarvis/stb-tester,stb-tester/stb-tester,stb-tester/stb-tester,martynjarvis/stb-tester,LewisHaley/stb-tester,LewisHaley/stb-tester,LewisHaley/stb-tester