• 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: Confused about CFRunLoop
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Confused about CFRunLoop


  • Subject: Re: Confused about CFRunLoop
  • From: Brian Greenstone <email@hidden>
  • Date: Tue, 18 Mar 2008 08:41:10 -0500

Yay, I knew there was a way to do this, and I finally figured it out! Ok, so I'm able to emulate the Carbon calls exactly how I wanted by doing this:

Step 1:  Create the CF Timer...

CFRunLoopTimerRef timer = CFRunLoopTimerCreate(...);
CFRunLoopAddTimer(CFRunLoopGetCurrent(), timer, kCFRunLoopDefaultMode);


Step 2:  Reenter the existing Main Loop with NS...

	[[NSApplication sharedApplication] run];		


Step 3: When it's time to exit our loop we call this from the Timer callback...


[[NSApplication sharedApplication] stop:[NSApplication sharedApplication]];


Step 4: The code returns to the line we started things in Step 2, so now we just do some cleanup..


	CFRunLoopTimerInvalidate(timer);
	CFRelease(timer);


Works perfectly! It inserts my timer into the main run loop and processes everything as it should. Now I just need to figure out the CF equivalent of thos NSApplication calls and then I can be Obj-C free ;)



-B


__________________________________________________________ Brian Greenstone President & CEO email@hidden Pangea Software, Inc. http://www.pangeasoft.net 12405 John Simpson Ct. voice/fax: (512)266-9991 Austin, TX 78732 __________________________________________________________




_______________________________________________

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: Confused about CFRunLoop
      • From: Eric Schlegel <email@hidden>
    • Re: Confused about CFRunLoop
      • From: "Hamish Allan" <email@hidden>
References: 
 >Confused about CFRunLoop (From: Brian Greenstone <email@hidden>)
 >Re: Confused about CFRunLoop (From: Eric Schlegel <email@hidden>)

  • Prev by Date: Re: Setting Web Proxy programmatically
  • Next by Date: Re: Setting Web Proxy programmatically
  • Previous by thread: Re: Confused about CFRunLoop
  • Next by thread: Re: Confused about CFRunLoop
  • Index(es):
    • Date
    • Thread