Differences From Artifact [dcc6f80f85]:
- File src/OFApplication.m — part of check-in [1ba08eebc5] at 2015-10-19 22:15:13 on branch trunk — Add platform.h & make platform defines consistent (user: js, size: 10305) [annotate] [blame] [check-ins using]
To Artifact [a553adbdf6]:
- File
src/OFApplication.m
— part of check-in
[8bc06182a4]
at
2015-11-21 23:44:33
on branch trunk
— Use sigaction() instead of signal()
This allows setting SA_RESTART. (user: js, size: 10835) [annotate] [blame] [check-ins using]
︙ | ︙ | |||
415 416 417 418 419 420 421 | - (id <OFApplicationDelegate>)delegate { return _delegate; } - (void)setDelegate: (id <OFApplicationDelegate>)delegate { | > > > | > > > > > > | > > > > > > | > > > > > | 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 446 447 448 449 450 451 452 453 454 455 456 457 458 459 460 461 462 463 464 465 | - (id <OFApplicationDelegate>)delegate { return _delegate; } - (void)setDelegate: (id <OFApplicationDelegate>)delegate { #ifdef HAVE_SIGACTION struct sigaction sa = { .sa_flags = SA_RESTART }; sigemptyset(&sa.sa_mask); # define REGISTER_SIGNAL(sig) \ if ([delegate respondsToSelector: \ @selector(applicationDidReceive##sig)]) { \ _##sig##Handler = (void(*)(id, SEL))[(id)delegate \ methodForSelector: \ @selector(applicationDidReceive##sig)]; \ \ sa.sa_handler = handle##sig; \ } else \ sa.sa_handler = SIG_DFL; \ \ OF_ENSURE(sigaction(sig, &sa, NULL) == 0); #else # define REGISTER_SIGNAL(sig) \ if ([delegate respondsToSelector: \ @selector(applicationDidReceive##sig)]) { \ _##sig##Handler = (void(*)(id, SEL))[(id)delegate \ methodForSelector: \ @selector(applicationDidReceive##sig)]; \ signal(sig, handle##sig); \ } else \ signal(sig, SIG_DFL); #endif _delegate = delegate; REGISTER_SIGNAL(SIGINT) #ifndef OF_WINDOWS REGISTER_SIGNAL(SIGHUP) REGISTER_SIGNAL(SIGUSR1) REGISTER_SIGNAL(SIGUSR2) #endif #undef REGISTER_SIGNAL } - (void)OF_run { void *pool = objc_autoreleasePoolPush(); OFRunLoop *runLoop; |
︙ | ︙ |