• 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
Re: NEWBIE: where to start my thread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NEWBIE: where to start my thread


  • Subject: Re: NEWBIE: where to start my thread
  • From: Julien Guimont <email@hidden>
  • Date: Thu, 6 Feb 2003 23:46:20 -0500

In fact, there is plenty of solutions for this. You found one, I'm not telling it is the most efficient. Here are two other.

You can put it in your Controller class but in an awakeFromNib function (awakeFromNib is called when every outlet is ready and available for the receiver).

Another trick (one you perhaps didn't know about) is to put your controller as a delegate of your application class (using IB). After that you just have to declare a function named applicationDidFinishLaunching (or something like that cmd-shift-c to find more;).

Those functions are VERY useful in many ways and you should take a look at them.

Julien Guimont
Juggy software
www.juggysoft.com/ridge.html <- the only internet connection watcher for OS X (featuring xfert limits!)
On Thursday, February 6, 2003, at 09:52 PM, email@hidden wrote:

Message: 6
Date: Thu, 6 Feb 2003 11:54:35 -0800
To: email@hidden
Subject: Re: NEWBIE: where to start my thread
From: Chris Cutler <email@hidden>

Never mind. I think I just found a solution: start the thread in the
init function of the target object. That is, have an object start a
thread on itself.

Sorry to bother you all.

Chris

cutler wrote:
Hello,

Where is the best place to usdetachNewThreadSelector:toTarget:withObject
to start a new thread? I would like my thread to start as soon as my
application has initialized.

Right now I'm starting it in the init function of my controller class
(using the MVC way of doing things). My controller is instantiated in
IB, as is the target class where the thread will start. When I run the
app the controller is instantiated before the the target class, so
there is nothing to start the thread on.

I've been unabled to find sample code which uses threads. Is there a
better place to start a thread which should strat as soon as the
applicaiton starts?

Thanks very much,
Chris
_______________________________________________
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.

  • Prev by Date: Calling class methods from other class methods
  • Next by Date: bad memory access problem
  • Previous by thread: Re: NEWBIE: where to start my thread
  • Next by thread: Re: OT: trouble getting "Cocoa Programming" ISBN: 0672322307 by Scott Anguish, Erik M. Buck, Donald A. Yacktman ?
  • Index(es):
    • Date
    • Thread