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

Re: NSThread question


  • Subject: Re: NSThread question
  • From: "Mike Vannorsdel" <email@hidden>
  • Date: Tue, 10 Jul 2001 15:40:20 -0600

You still need a [pool release] at the end of doImage. But the real problem is that you shouldn't do any GUI work from a secondary thread. GUI drawing should be done in the main thread while calculations in the secondary thread. Quite a bit of the AppKit is not really thread safe.


On Tuesday, July 10, 2001, at 05:44 AM, Aurilien wrote:

I still have an error (signal 10 (SIGBUS)). I'll explain exactly what I
do:

I have a -(void)doImage; method in a custom NSView object. This is the
method I'm calling in the new Thread, and it goes like this:

-(void)doImage
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc ] init];
[ self display ];
}

the method in which I call it goes like this:

-(void) setData:(NSData *) data
{
myData = [[NSData alloc] initWithData:data];
cachedImage = nil;
[NSThread detachNewThreadSelector:@selector(doImage) toTarget:self
withObject:nil];
}

Still obscure to me what causes the crash...


References: 
 >Re: NSThread question (From: Aurélien <email@hidden>)

  • Prev by Date: Re: NSTask - grep
  • Next by Date: Re: getLineStart:end:contentsEnd:forRange:
  • Previous by thread: Re: NSThread question
  • Next by thread: Re: NSThread question
  • Index(es):
    • Date
    • Thread