Fix 100% processor usage in macos.