> On May 13, 2016, at 12:34 PM, Carl Hoefs <newsli...@autonomy.caltech.edu> > wrote: > > As a test, the above works if run on the main thread, so I'm guessing it has > something to do with there being no runloop after the background thread > exits.
Yup. More precisely, the background thread has no runloop at all. Its top-level function is the method you’re running, so as soon as your method returns, the thread exits. You can use runloops on background threads, but the thread’s top-level function has to end with [[NSRunLoop currentRunLoop] run]; which starts the runloop. That call generally never returns, unless you stop that runloop. These days it’s probably better to use dispatch queues instead. —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