On Apr 19, 2007, at 4:33 AM, Guillermo wrote: > Exactly, I need something like the "WaitNextEvent" in the old Mac OS > API but for Socket, that waits for a Socket Event without trashing CPU > time. > > I have my app nearly finished but consumes a lot of CPU waiting for > packets, this is a big problem on laptops running on battery power. > > I don't know if would be possible to use semaphores for this matter, I > tried it sometime ago but I didn't find a reliable method.
What we really need is a call to select where we can tell it what streams we're interested in waiting for like I do in C every day. It just sleeps until some timeout or until one of the flagged streams has data. I've written this up as a feature request for command line apps several times over the years, the first time about 2 days after the command line compile showed up ;) but nothing recently... It's even more important in the command line app as there s no way to even make your code async as you dont get the same kind of events. Polling in a loop is the only way and thats just wrong. If we had access to the IO Descriptors of the sockets it might be possible to declare to a call to select, but I have no idea what that would do to the RB framework and i have no idea how to get the file descriptors out as there dont appear to be any pointers or low level structures you can get for a file or a socket object. So I've added a new feature request for select like functionality that you can sign on to and add comments to if anybody else sees the value in having this: http://www.realsoftware.com/feedback/viewreport.php?reportid=ljkjbqvb Thanks, James _______________________________________________ Unsubscribe or switch delivery mode: <http://www.realsoftware.com/support/listmanager/> Search the archives: <http://support.realsoftware.com/listarchives/lists.html>
