• 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: SIGIO and AppKit main loop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: SIGIO and AppKit main loop


  • Subject: Re: SIGIO and AppKit main loop
  • From: Bob Ippolito <email@hidden>
  • Date: Mon, 29 Mar 2004 20:10:28 -0500

On Mar 29, 2004, at 1:08 PM, Douglas Davidson wrote:

On Mar 29, 2004, at 4:55 AM, Michael Rothwell wrote:

Cocoa appears to have no equivalent of glib's "IO Channels," which are
really useful, and do not use threads. GIOChannel integrates with the
application's main thread and invokes callback functions for registered
events, such as ready-to-read, ready-to-write, ready-to-accept, etc. I
imagine it integrates the file descriptor in question with a
general-purpose select() or poll() done in the main application loop.

CFSocket does exactly that. The more convenient interfaces for most purposes are the higher-level CFStream, NSStream, et al. See e.g.

<http://developer.apple.com/documentation/Networking/Conceptual/ CFNetwork/Preface/>

The original question referred to signals. Cocoa does not interfere with signal delivery, but Cocoa calls must be treated as unsafe to use from signal handlers. This is not a Cocoa-specific issue; there really is very little that can be done safely from a signal handler. The suggestion of setting a flag and handling it elsewhere is probably best.

I've also seen signal handlers that send a message on a mach port (that's also on the runloop) instead of setting a flag, which is better because you don't end up polling. I believe I saw this first in the mDNSResponder source code?

-bob
_______________________________________________
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.


  • Follow-Ups:
    • Re: SIGIO and AppKit main loop
      • From: Douglas Davidson <email@hidden>
References: 
 >Re: SIGIO and AppKit main loop (From: Mike Davis <email@hidden>)
 >Re: SIGIO and AppKit main loop (From: John Stiles <email@hidden>)
 >Re: SIGIO and AppKit main loop (From: Michael Rothwell <email@hidden>)
 >Re: SIGIO and AppKit main loop (From: Michael Rothwell <email@hidden>)
 >Re: SIGIO and AppKit main loop (From: Mike Davis <email@hidden>)
 >Re: SIGIO and AppKit main loop (From: Michael Rothwell <email@hidden>)
 >Re: SIGIO and AppKit main loop (From: Douglas Davidson <email@hidden>)

  • Prev by Date: Re: Converting ASCII to UTF-8?
  • Next by Date: Re: classic floating window behavior?
  • Previous by thread: Re: SIGIO and AppKit main loop
  • Next by thread: Re: SIGIO and AppKit main loop
  • Index(es):
    • Date
    • Thread