Fix build issues with event loop

Also provide a clean shutdown for the c++ event loop implementation.

Fixes https://github.com/skabbes/mx3/issues/12