Re: POSIX sockets and event loops
Re: POSIX sockets and event loops
- Subject: Re: POSIX sockets and event loops
- From: "Duane Murphy" <email@hidden>
- Date: Thu, 20 May 2004 15:28:25 -0700
--- At Thu, 20 May 2004 15:16:53 -0700, Duane Murphy wrote:
>
--- At Thu, 20 May 2004 15:57:17 -0500, Aaron Ballman wrote:
>
>
>As much as I hate to admit this: we have an event loop that's using
>
>WaitNextEvent. When sockets are active, we pause for as little time
>
>possible (pass in 0 to WaitNextEvent), yet I am still finding that
>
>about 15% of my application's time is being spent in that one call.
>
>I am determining this by using Shark FWIW.
>
>
>
>Because my application uses select to poll the socket for sends and
>
>receives, this sort of a hiccup in the application's event loop seems
>
>to slow my transfers down more than I care for.
>
>
>
>Aside from the obvious (but quite difficult) answer of: stop using
>
>WaitNextEvent and use Carbon events everywhere... is there a way to
>
>cause WaitNextEvent to wake up when network I/O is occurring? For
>
>example, if I were to use signals instead of select, would the
>
>signals cause WaitNextEvent to not delay so long?
>
>
You can use Carbon Events and WNE togther. I do it all the time,
>
specifically for network callbacks. Works great. Less filling.
>
>
WaitNextEvent just calls RunApplicationEventLoop for you. You're still
>
executing CarbonEvents, you just never see them.
I should clarify. I'm not using Carbon Events. I am using the
CFSocketCreateRunLoopSource() and run loops. I think that's what you want
to use in order to detect network I/O.
...Duane
_______________________________________________
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.