Hi, This code (or the basis of it) was actually given to me by a Cocoa developer from this list.
> On 30 Jun 2015, at 15:19, Andreas Grosam <agro...@onlinehome.de> wrote: > > This kind of approach doesn't make sense and introduces a lot of issues. It does make sense for certain kinds of problems and in the context in which is was used, it made sense to do it this way. > You occupy a thread which just waits for a result of a task (and thus merely > blocks). The thread does other processing before and after this, and in the context it is used to it works fine with no or little noticeable difference. > You doesn't cancel the async task properly when a timeout occurs. This is just sample the code, that I cut and pasted quickly, there are some bits missing, it the OP is interested I can send off list. > And additionally you introduce a potential data race. It works fine in the context its used in. > You could avoid all that by simply following asynchronous patterns: just > implement the continuation (completion handler) of the already given > asynchronous method. Unfortunately, In the real world that’s not always possible or desirable. Cheers Dave _______________________________________________ Cocoa-dev mailing list (Cocoa-dev@lists.apple.com) Please do not post admin requests or moderator comments to the list. Contact the moderators at cocoa-dev-admins(at)lists.apple.com Help/Unsubscribe/Update your Subscription: https://lists.apple.com/mailman/options/cocoa-dev/archive%40mail-archive.com This email sent to arch...@mail-archive.com