Basic event loop programming example