CFRunLoop usage
CFRunLoop usage
- Subject: CFRunLoop usage
- From: "Ron Anderson" <email@hidden>
- Date: Tue, 7 Oct 2003 16:00:40 -0400 (EDT)
- Organization: AOL
I need to know if a particular usage of CFRunLoop is acceptable.
Currently, I am getting limited behavior. The question is whether I'm
merely misusing CFRunLoop or if the whole idea is flawed from the
beginning.
Basically, I need to dispatch a window (in Cocoa) and then run a local
event loop to handle events for the window (to support a synchronous call
without additional thread) and when the window is completed, continue on.
Dispatching the window is simple enough. This is a modeless window. But
my usage of CFRunLoop is where my confusion begins. Here's the code I
currently use to implement a local event loop.
while( !done )
{
CFRunLoopRef cfRunLoop = CFRunLoopGetCurrent();
if( cfRunLoop )
{
while( CFRunLoopRunInMode(kCFRunLoopDefaultMode, 0.0, true) ==
kCFRunLoopRunHandledSource )
{
;
}
}
}
Ok, I'm still a bit foggy about the modes related to runloops, but I have
also tried running the runloop in the three basic modes
(General,Modal,EventTracking). Nothing changes.
Basically the window does get displayed, but window controls do not
dispatch events (can't click on buttons, etc). Is there something I am
completely missing? Is it a fools errand to try and implement a local
event loop like this instead of spawning a thread and blocking while the
UI is presented on the main thread runloop? I really wish the
documentation was better so I could identify if my problem is api usage,
or design.
Any help is appreciated.
Ron Anderson
_______________________________________________
cocoa-dev mailing list | email@hidden
Help/Unsubscribe/Archives:
http://www.lists.apple.com/mailman/listinfo/cocoa-dev
Do not post admin requests to the list. They will be ignored.