Re: Question on threads running in my Foundation tool
Re: Question on threads running in my Foundation tool
- Subject: Re: Question on threads running in my Foundation tool
- From: Michael Ash <email@hidden>
- Date: Sat, 21 Feb 2009 19:08:50 -0500
On Sat, Feb 21, 2009 at 12:27 PM, Shawn Erickson <email@hidden> wrote:
> On Fri, Feb 20, 2009 at 6:50 PM, Michael Vannorsdel <email@hidden> wrote:
>> It should be more like:
>>
>> //create timer
>> //add timer to runloop
>>
>> CFRunLoopRun(); //code blocks here (not really since the loop is
>> running) until runloop exits due to no longer having observers or timers
>>
>> //do thread cleanup and exit
>
> Note framework code could add sources to the runloop outside of your
> direct control. This can make depending on the runloop exiting when
> you remove your sources problematic.
Exactly right. When the docs talk about how a runloop will exit when
it has no sources, think of it as a threat, not a promise. It's
behavior you have to guard against, but it's not something you can
count on.
Mike
_______________________________________________
Cocoa-dev mailing list (email@hidden)
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:
This email sent to email@hidden