• 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: Threading Question
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: Threading Question


  • Subject: Re: Threading Question
  • From: Matthew Holiday <email@hidden>
  • Date: Tue, 25 Oct 2005 07:52:30 -0500

You don't need a pointer to the thread; you do need a pointer to a delegate object and to know what method on that delegate you'd like to call.

Take a look at my sample code at: http://homepage.mac.com/matthol2/ cocoa/page1/page1.html (the "Threaded Connection" entry). Ignore the timer stuff; note how the user (e.g, a document) calls a method on the connection which detaches a thread using the calling object as delegate, and then calls back to that delegate.

On Oct 24, 2005, at 9:42 PM, Jonah Horowitz <email@hidden> wrote:

Message: 17
Date: Mon, 24 Oct 2005 19:40:12 -0700 (PDT)
From: Jonah Horowitz <email@hidden>
Subject: Re: Threading Question
Message-ID: <email@hidden>

That seems reasonable, my problem is that I'm not sure how to call performSelectorOnMainThread... I need a pointer to the main thread, which I don't have. I can have the main thread call a function after detachNewThread... which sets the value of a thread variable, like so:

- (void)setGlobalController:(MainController *)controller
{
    globalController = controller;
}

globalController being defined in my worker.h as
    MainController* globalController;
but this just doesn't seem like it's the right way to do it.

Jonah

_______________________________________________ Do not post admin requests to the list. They will be ignored. Cocoa-dev mailing list (email@hidden) Help/Unsubscribe/Update your Subscription: This email sent to email@hidden
  • Prev by Date: Re: Problem while Porting from tiger to Panther
  • Next by Date: Re: Strange behavior of stringWithFormat and accented characters (RESOLVED)
  • Previous by thread: Re: Threading Question
  • Next by thread: NSBMPFileType and resolution setting
  • Index(es):
    • Date
    • Thread