> On Jun 29, 2015, at 9:14 AM, Gavin Eadie <ga...@umich.edu> wrote:
> 
> Can anyone, with more knowledge than we have, suggest a trick that allows an 
> apparently synchronous call on the main thread without impacting performance?

Not without some nasty hacks that I wouldn’t recommend.

The simplest one is to run a nested runloop while you wait for the async call 
to complete. This will allow the app to keep handling user events. The problem 
is that your code can now be called re-entrantly and you can run into some 
really confusing problems that way (it’s happened to me.)

Other solutions involve crazy runtime manipulation of the stack to accomplish 
what functional languages call “continuations”. This is sort-of kind-of doable 
in C, and I’ve looked into it, but the complexity isn’t worth it.

—Jens
_______________________________________________

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

Reply via email to