voicepax.blogg.se

Mac os program reopen looping
Mac os program reopen looping









mac os program reopen looping

Timer sources deliver events to their handler routines but do not cause the run loop to exit. The input sources deliver asynchronous events to the corresponding handlers and cause the runUntilDate: method (called on the thread’s associated NSRunLoop object) to exit. Both types of source use an application-specific handler routine to process the event when it arrives.įigure 3-1 shows the conceptual structure of a run loop and a variety of sources. Timer sources deliver synchronous events, occurring at a scheduled time or repeating interval. Input sources deliver asynchronous events, usually messages from another thread or from a different application. Within your loop, you use a run loop object to "run” the event-processing code that receives events and calls the installed handlers.Ī run loop receives events from two different types of sources. Your code provides the control statements used to implement the actual loop portion of the run loop-in other words, your code provides the while or for loop that drives the run loop. It is a loop your thread enters and uses to run event handlers in response to incoming events. Anatomy of a Run LoopĪ run loop is very much like its name sounds. For additional information about run loop objects, see NSRunLoop Class Reference and CFRunLoop Reference. The following sections provide more information about run loops and how you configure them for your application.

mac os program reopen looping

The app frameworks automatically set up and run the run loop on the main thread as part of the application startup process. Only secondary threads need to run their run loop explicitly, however.

mac os program reopen looping

Your application does not need to create these objects explicitly each thread, including the application’s main thread, has an associated run loop object. Both Cocoa and Core Foundation provide run loop objects to help you configure and manage your thread’s run loop. You must still design your thread’s code to start the run loop at appropriate times and respond to incoming events. Run loop management is not entirely automatic. The purpose of a run loop is to keep your thread busy when there is work to do and put your thread to sleep when there is none. A run loop is an event processing loop that you use to schedule work and coordinate the receipt of incoming events. Run loops are part of the fundamental infrastructure associated with threads.











Mac os program reopen looping