extension of NSRunLoop for waiting.