Implement cocoa run loop.