• Open Menu Close Menu
  • Apple
  • Shopping Bag
  • Apple
  • Mac
  • iPad
  • iPhone
  • Watch
  • TV
  • Music
  • Support
  • Search apple.com
  • Shopping Bag

Lists

Open Menu Close Menu
  • Terms and Conditions
  • Lists hosted on this site
  • Email the Postmaster
  • Tips for posting to public mailing lists
Re: Question on threads running in my Foundation tool
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Question on threads running in my Foundation tool


  • Subject: Re: Question on threads running in my Foundation tool
  • From: Michael Vannorsdel <email@hidden>
  • Date: Fri, 20 Feb 2009 19:50:11 -0700

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

When you start a new thread it has a run loop but it's not running and so anything that handles events and whatnot needs the run loop running to process these events. So once you set up all your timers, event handlers, observers, you then finally need to start (run) the loop so it can work its magic. If you sleep or otherwise block a thread (like you did with sleep), it will sit there and do nothing else including no run loop processing until the block is cleared.


On Feb 20, 2009, at 5:23 PM, Ken Thomases wrote:

On Feb 20, 2009, at 1:15 PM, Charles E. Heizer wrote:

Since this app is a bit of a scheduler for the tasks it could be running for a while, so for my testing I implemented a while loop to keep it running.

	BOOL isRunning = YES;
	while(isRunning)
	{
		sleep(10);
	}

That's not a run loop. A run loop is a specific concept supported by Cocoa and Core Foundation. Look up CFRunLoop and NSRunLoop.


The above loop won't help in the cleanup of those framework-created threads, at all.
_______________________________________________

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


  • Follow-Ups:
    • Re: Question on threads running in my Foundation tool
      • From: Shawn Erickson <email@hidden>
References: 
 >Question on threads running in my Foundation tool (From: "Charles E. Heizer" <email@hidden>)
 >Re: Question on threads running in my Foundation tool (From: Nick Zitzmann <email@hidden>)
 >Re: Question on threads running in my Foundation tool (From: "Charles E. Heizer" <email@hidden>)
 >Re: Question on threads running in my Foundation tool (From: Nick Zitzmann <email@hidden>)
 >Re: Question on threads running in my Foundation tool (From: "Charles E. Heizer" <email@hidden>)
 >Re: Question on threads running in my Foundation tool (From: Ken Thomases <email@hidden>)

  • Prev by Date: scrollers display malfunction in scroll view
  • Next by Date: Re: who does like Objective-C 2.0 "properties" dot syntax ?
  • Previous by thread: Re: Question on threads running in my Foundation tool
  • Next by thread: Re: Question on threads running in my Foundation tool
  • Index(es):
    • Date
    • Thread