Thread Question
Thread Question
- Subject: Thread Question
- From: Dave Keck <email@hidden>
- Date: Tue, 27 Apr 2004 21:43:35 -0400
Hey,
after following along with these posts on NSTimers and NSThreads, I
remembered a question I've had for awhile now...
Say I have a thread, myThread, and I also have the main thread,
mainThread. I also have a method, myMethod:
Question 1: Is it OK to call myMethod from myThread? Is myMethod within
the "scope" of myMethod (assuming all this code is in the same class)?
Question 2: If Question #1 is "yes": is it safe to call myMethod from
both mainThread and myThread, possibly at the same time (if, say,
mainThread and myThread both had loops that called myMethod)? (Would I
have to use NSLocks for methods too?)
Question 3: If it is OK to call myMethod from both mainThread and
myThread: what happens when I do? Does it call the method by the same
address if I were to call it from mainThread and myThread, or does each
thread have its own "copy" of each method that it calls?
Thank you very much for any insight!
Dave
_______________________________________________
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.