• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Objective-C in signal handlers (was Re: Inter process communication question)
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Objective-C in signal handlers (was Re: Inter process communication question)


  • Subject: Re: Objective-C in signal handlers (was Re: Inter process communication question)
  • From: Terry Glass <email@hidden>
  • Date: Wed, 5 Feb 2003 19:03:55 -0600

On Wednesday, February 5, 2003, at 06:24 PM, Greg Parker wrote:

Don't do that. Sending Objective-C messages from inside a signal
handler is unsafe. If the signal happens to arrive at the wrong
time, the Objective-C runtime will deadlock because the signal
handler will try to grab a lock that's already held by the
interrupted thread.

I said in my original message that I knew how I was handling SIGHUP was bad.

In general, you can't do anything inside a signal handler other than
write() to a pipe or set a global variable that some other thread is
watching. exit() is definitely unsafe because it might call atexit()
handlers; use _exit() instead. unlink() might be safe if it's just a
single system call, but I'm not sure about that.

For SIGTERM, I was working according to section 10.6 of APUE, where Stevens states that POSIX.1 specifies that unlink must be reentrant. I assume that OS X is mostly POSIX compliant?
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.
  • Prev by Date: Re: NSWorkspaceDidTerminateApplicationNotification and background app
  • Next by Date: Re: Objective-C in signal handlers (was Re: Inter process communication question)
  • Previous by thread: Bug in TextSizingExample
  • Next by thread: Re: Objective-C in signal handlers (was Re: Inter process communication question)
  • Index(es):
    • Date
    • Thread