Re: Confused about CFRunLoop
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