Re: NSThread - plz help!!!
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.