Если вы можете обнаружить, что хотите легко выйти, изменение функции main()
в вашем приложении - самое быстрое место:
int main(int argc, char **argv)
{
id pool = [[NSAutoreleasePool alloc] init]; //needed if shouldExit() uses Cocoa frameworks
@try {
if(shouldExit()) {
exit(0); //appropriate exit code, depending on whether this "fast" exit is normal or exceptional
}
}
@finally {
[pool drain];
}
return NSApplicationMain(argc, (const char **) argv);;
}