New mainLoop to reduce the CPU usage when idle

Using the threaded rts still seems less stable on OS X