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

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.

  • Follow-Ups:
    • Re: CFRunLoop usage
      • From: Izidor Jerebic <email@hidden>
    • Re: CFRunLoop usage
      • From: "Alastair J.Houghton" <email@hidden>
  • Prev by Date: Window Loses Mouse Moved Events After Selecting From Menu
  • Next by Date: Re: Multiple Threaded Windows
  • Previous by thread: Re: Window Loses Mouse Moved Events After Selecting From Menu (SOLVED)
  • Next by thread: Re: CFRunLoop usage
  • Index(es):
    • Date
    • Thread