5 ms·
This isn't really correct. Runloops have modes. Often networking happens in a mode that is not restricted (see NSRunLoopCommonModes here https://developer.apple
by zbowling 13y ago
This isn't really correct. Runloops have modes. Often networking happens in a mode that is not restricted (see NSRunLoopCommonModes here https://developer.apple.com/library/ios/documentation/cocoa/reference/foundation/Classes/NSRunLoop_Class/Reference/Reference.html https://developer.apple.com/library/ios/documentation/cocoa/... ).
If you are running your network code in default mode on the main thread (problematic doing that and it's probably better to use async methods these days) then yes that can happen but it's usually programmer error.
On Mac, entering a modal window will usually put the runloop in a context that regular events won't fire and only those that mater to the modal window will fire. Commons mode almost always fires though.
I work on Apportable (YC2011) and we have reimplemented CFRunLoop/NSRunLoop down to the bare metal. A lot of misconceptions on how it works we find.
- LinaLauneBaer 13y agoThanks for the clarification. I am aware of what you mention in your answer. In my statement I simplified quite a bit. I know that runloops have different modes. What I was saying is that if you just use the "defaults" then you will see the phenomenon that I described. And I don't think that it is a programmer error if you use the defaults... but sure: These days you would probably just use a framework or take care of these details... May I know why you have reimplemented CFRunLoop?
- zbowling 13y agoIt almost always programmer error to use defaults mode for NSURLConnection, especially on Mac where they are more runloop modes used by the platform that are not inclusive of defaults mode, unless the user has a very specific reason. File IO is usually ok in defaults mode because it makes code easier and you don't have to worry about timeouts. We make Objective-C run on Android at Apportable :-) The entire stack. Everything from clang, GCD, CoreFoundation, Foundation, UIKit, and dozens of comm frameworks. It's fairly popular with game developers. We recently re-developed all of Foundation from scratch on top of the parts of CFLite that Apple open sources and no longer use GNUStep. http://docs.apportable.com/release-notes.html#1100 http://docs.apportable.com/release-notes.html#1100 We have even open sourced all our tests around Foundation as well and this is one of them. Check it out: https://github.com/apportable/FoundationTests https://github.com/apportable/FoundationTests
- LinaLauneBaer 13y agoI still don't agree that it is programmer error per se... but we don't have to agree on that. :) Your idea is somewhat similar to "our" idea... at Objective-Cloud we try to bring Objective-C to the cloud... :) You try to bring it to Android. What a coincidence. Nice to meet you. :)
- zbowling 13y agoWe should talk off list. :-)
- LinaLauneBaer 13y ago:) My email address is in my profile in case you did not already find it...
- weland 13y ago> And I don't think that it is a programmer error if you use the defaults... but sure: These days you would probably just use a framework or take care of these details... It's usually a programmer error when you write code that does something other than what you intend, regardless of whether or not what you intend to do is the default behaviour. I think this is perfectly understandable behaviour for a framework of such a general purpose. The whole convention over configuration thing works for tools like Ruby on Rails and web2py. 90% of the applications written using them are pretty much identical and the non-technical constraints favour quick delivery over well-adapted architecture, so you can afford making it obnoxiously hard for the rest of 10%.