• 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: listen socket with runloops strange CPU usage
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: listen socket with runloops strange CPU usage


  • Subject: Re: listen socket with runloops strange CPU usage
  • From: Nicolas Berloquin <email@hidden>
  • Date: Mon, 26 Apr 2004 11:24:48 +0200

I believe you're wrong, because
- I can see a separate thread anyway that does the polling (created by the framework). when you add the source,
you're telling where the callback is supposed to run, not the polling.
- the main loop is blocked in between each event (and can sleep a long time if there's none).
- it's a runLoopSource, meaning that if the polling thread notices data coming in, it tells the mainloop
to run the runloopsource once for this "event".

So the behavior should be the same.
But that's where I may be wrong ^_^

otherwise, the socket is performing correctly in both cases, yeah.

On 26 avr. 04, at 08:41, Mike Miller wrote:

I don't know a lot about run loop but it makes a little bit of sense. The
main threads run loop is usually never blocked while other threads can spend
the majority of their time blocked. When you put the source in the main loop
I think the effect may be similar to polling the socket for activity hence
the spike in cpu usage. Apples documentation doesn't explictly say not to do
this AFAIK but there are a number of hints that point towards putting this
in a secondary thread. Is the socket performing correctly in both cases?
_______________________________________________
macnetworkprog mailing list | email@hidden
Help/Unsubscribe/Archives: http://www.lists.apple.com/mailman/listinfo/macnetworkprog
Do not post admin requests to the list. They will be ignored.


References: 
 >Re: listen socket with runloops strange CPU usage (From: Mike Miller <email@hidden>)

  • Prev by Date: Re: listen socket with runloops strange CPU usage
  • Next by Date: Re: listen socket with runloops strange CPU usage
  • Previous by thread: Re: listen socket with runloops strange CPU usage
  • Next by thread: Re: listen socket with runloops strange CPU usage
  • Index(es):
    • Date
    • Thread