• 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 - plz help!!!
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: NSThread - plz help!!!


  • Subject: Re: NSThread - plz help!!!
  • From: Drew McCormack <email@hidden>
  • Date: Thu, 7 Mar 2002 20:49:53 +0100

- (void) setupSearch:
{
...
[NSThread detachNewThreadSelector:@selector(searchForFiles:)
toTarget:self withObject:searchData];
...
}

- (void) searchForFiles:(id)searchData
{
NSAutoreleasePool *pool = [[NSAutoreleasePool alloc] init];
...
while(pname = [direnum nextObject])
{
if([[[direnum fileAttributes] fileType]
isEqualToString:NSFileTypeRegular])
{
...
//[table reloadData]; this line is not thread safe
[self update]; //update is in main application thread.
Wouldn't you need to setup an NSConnection and then message a proxy of self (in the main thread), rather than calling "update" directly. It seems to me that this will call update in the worker thread, and you may get problems with the GUI thread-safety.

Just to add to suggestions, I can recommend "ThreadWorker" as a class to help simplify threading. Download it at http://iharder.sourceforge.net/macosx/threadworker/

Drew McCormack

... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ... ...
Dr. Drew McCormack
Trade Strategist (www.trade-strategist.com)
Trading simulation software for Mac OS X
_______________________________________________
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.
References: 
 >Re: NSThread - plz help!!! (From: Esteban <email@hidden>)

  • Prev by Date: OpenGL GLUT & GLUI problems
  • Next by Date: Re: Newbie (to Cocoa) questions
  • Previous by thread: Re: NSThread - plz help!!!
  • Next by thread: Re: NSThread - plz help!!!
  • Index(es):
    • Date
    • Thread