Re: App crashes on thread exit
Re: App crashes on thread exit
- Subject: Re: App crashes on thread exit
- From: Fabio Genoese <email@hidden>
- Date: Sun, 13 Oct 2002 10:47:27 +0200
Am Samstag, 12.10.02 um 22:27 Uhr schrieb Cameron Hayne:
Several comments:
1) It seems that qstat & records are ivars. Have you retained them?
qstat is a class (should be 'QStat' then, I know), records is an ivar.
Where should I retain ivars? Sorry, I come from the Java side. I did
some Cocoa-Java stuff before so Cocoa isn't that new to me but the
whole alloc/retain/release stuff somewhat is.
2) I don't see the point of having the NSLock here. Usually you create
an
NSLock object somewhere before your program becomes multi-threaded -
i.e. at
initialization, and then use it in more than one thread.
Thank you! It seems that extending the lock how you suggested prevents
the crash.
3) Usually you do the pool alloc & release at the beginning and end of
each
thread - not in some short-lived method which gets invoked several
times in
the thread. Nothing wrong with doing this as far as I can see, but not
necessary to do it so often.
The method sThread is the whole secondary thread. Does it make a
difference in performance if I do the pool alloc before I call
'[NSThread detachNewThreadSelector: @selector(sThread:)...' and release
it after that line?
4) You are overwriting the value of the 'record' pointer you allocated
with
the value you get back from [s data].
Fixed.
Fabio
_______________________________________________
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.