Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 7034091
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 28, 20262026-05-28T01:08:39+00:00 2026-05-28T01:08:39+00:00

On Mac OS X, Cocoa is event driven. By this I mean each thing

  • 0

On Mac OS X, Cocoa is event driven. By this I mean each thing is driven by the UI – the user clicking something or moving over a certain area results in an event handler being called. Main simply calls NSApplicationMain () which creates an infinite loop till the program exits.

What about tasks that aren’t user driven though? Where would I put tasks that need to work in the background to provide the basic functionality of the program? For example, Photo Booth does certain things when the user interacts with the UI (i.e. changes to video camera when user click on a certain button). However, Photo Booth is also continuously retrieving frames from the camera to provide a video stream.

So my question is where do non-UI tasks code go? Main() isn’t really a possibility since I need the tasks to run throughout the life of the program rather than when the program just starts.

I’m on Mac OS X Snow Leopard (I want something that works on all Mac Systems though: i.e. Lion OS X) and am using a Obj-C Cocoa application in Xcode.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-28T01:08:39+00:00Added an answer on May 28, 2026 at 1:08 am

    Any application cocoa based Application has access to using RunLoops.

    Any work your app would want to do, would make use of the RunLoop to execute. Typically this is done on other threads, but if the work is lightweight enough not to cause your UI thread to block, you can run your code on the Main threads RunLoop.

    I recommend reading Apple’s Thread Programming Guide for more info.

    With Grand Central Dispatch, the programming models have changed to make use of today’s multicore systems, so it’s possible to define a task and have the OS manage it’s execution.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I'm a total newbie to programming in cocoa for the mac so this question
I was reading this paper from Apple: http://developer.apple.com/library/mac/documentation/cocoa/conceptual/OOP_ObjC/OOP_ObjC.pdf where it talks about OOP which
I have a very simple Mac Cocoa app that just has a Web View
I'm working on a Cocoa Mac app where I need to display a window/view
I used the cocoa of MAC to develop a plugin with safari , I
I'm developing a Mac OS X Cocoa app and want to use several .dylib
According to Cocoa Programming for Mac OS X, 3rd Edition, on page 202 (chapter
According to Cocoa Programming for Mac OS X, 3rd Edition , on page 245
I'm working through Cocoa Programming for Mac OS X (3rd ed) and in chapter
I followed the Tutorial in Cocoa Programming For Mac OS X to create a

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.