• 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
A simple question about nsthread
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

A simple question about nsthread


  • Subject: A simple question about nsthread
  • From: Andrea Salomoni <email@hidden>
  • Date: Thu, 1 Dec 2005 09:40:16 +0100

Hi to all,

I wrote a very simple app as exercise.
I have two classes, in the first one (the controller of the app) I have an action like this:

-(id)init
{
[super init];
theClass * myObject = [[theClass alloc]init];
return self;
}
-(IBAction)doSomething:(id)sender
{

[NSThread detachNewTrheadSelector:@selector(firstMethod:) toTarget:myObject withObject:nil];

}

I have a second class (theClass)

-(void)firstMethod:(id)owner
{
NSAutoreleasePool * myPool = [[NSAutoreleasePool alloc]init];

//start the tasks;
[myTextFieldOnTheGUI performSelectorOnMainThread:@selector (setStringValue:) withObject@"aString" waitUntilDone:NO];

[myPool release];
}

The problem is that the thread starts and all works fine, but the GUI isn't affected by performSelectorOnMainThread: method.
I read all the doc about safe and not safe object and about NSString the doc says to use performSelectorOnMainThread: method as I did....
I read about NSLock, NSConditionLock but don't think that locks or mutex locks may help about it.... I think this is a cocoa conceptual problem... maybe I missed something about that method.
I read about distributed object ... but it seems that distributed object are used much more for network apps.
All Outlets are connected and if I put the method performSelectorOnMainThread in the controller class all works (but inside another thread).

Is there anyone may explain me what happen on this app?

Thank you all for big support
Andrea

_______________________________________________
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
  • Follow-Ups:
    • Re: A simple question about nsthread
      • From: j o a r <email@hidden>
  • Prev by Date: How to Get Image out of NSOpenGLView using offline renderer.
  • Next by Date: Re: A simple question about nsthread
  • Previous by thread: Re: How to Get Image out of NSOpenGLView using offline renderer.
  • Next by thread: Re: A simple question about nsthread
  • Index(es):
    • Date
    • Thread