• 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: UNIX signals
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: UNIX signals


  • Subject: Re: UNIX signals
  • From: "Michael Ash" <email@hidden>
  • Date: Wed, 17 Dec 2008 22:55:17 -0500

On Wed, Dec 17, 2008 at 2:32 PM, Greg Parker <email@hidden> wrote:
> On Dec 16, 2008, at 7:22 PM, Michael Ash wrote:
>>
>> On Tue, Dec 16, 2008 at 8:02 PM, Chris Idou <email@hidden> wrote:
>>>
>>> Is there any Cocoa and/or Carbon interface to UNIX signals?
>>
>> Nope. It's pretty easy to set up a signal handler that can call back
>> to a Cocoa/CoreFoundation runloop though, by having it write to a pipe
>> or mach port which the runloop monitors.
>
> Be warned that, to a close approximation, your code isn't allowed to do
> anything inside the signal handler itself. This includes sending any
> Objective-C messages to any object. (objc_msgSend may take locks. If the
> signal is interrupting a thread that already holds those locks, you're
> stuck.)
>
> The official list of functions you can call is in the sigaction man page.
> Some Mach functions are also safe, but I don't know of an official list of
> which ones.

Yep, that's a very good point. To use my suggestion, your signal
handler must do *nothing* but write to the pipe or mach port, and it
must ensure that the write is guaranteed non-blocking. This isn't too
hard, but it must be adhered to rigidly.

Mike
_______________________________________________

Cocoa-dev mailing list (email@hidden)

Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com

Help/Unsubscribe/Update your Subscription:

This email sent to email@hidden

  • Follow-Ups:
    • Re: UNIX signals
      • From: Jean-Daniel Dupas <email@hidden>
References: 
 >UNIX signals (From: Chris Idou <email@hidden>)
 >Re: UNIX signals (From: "Michael Ash" <email@hidden>)
 >Re: UNIX signals (From: Greg Parker <email@hidden>)

  • Prev by Date: Re: Sorting a bound NSTableView programatically
  • Next by Date: Re: Thread ID in crash log
  • Previous by thread: Re: UNIX signals
  • Next by thread: Re: UNIX signals
  • Index(es):
    • Date
    • Thread