Multithreading and Mach ports
Multithreading and Mach ports
- Subject: Multithreading and Mach ports
- From: John Love <email@hidden>
- Date: Tue, 9 Dec 2008 15:36:09 -0500
Reference:
http://developer.apple.com/documentation/Cocoa/Conceptual/Multithreading/RunLoopManagement/chapter_6_section_5.html#/
/apple_ref/doc/uid/10000057i-CH16-SW7
I've got several questions since I'm just starting to investigate Mach
Ports.
1) Why is +LaunchThreadWithPort: so designated, ie, a class method.
It seems to me that as far as the specific code listings presented, a
class method is not required? For example, [workerObj
sendCheckinMessage:distantPort] could be replaced with [self
sendCheckinMessage:distantPort] if LaunchThreadWithPort would be
changed to an instance method.
2) Maybe the real question #1 is: What exactly is the object in the
background thread, named workerObj ??
3) I've saved my most general question to last, at least for this
trip: currently when I enter my method to start up my background
thread or threads, I simply call (several times if I have multiple
threads:
[NSThread detachNewThreadSelector:@selector(bgCalcThread:)
toTarget:self withObject:nil]
If I have multiple background threads, I can use a NSMutableDictionary
with multiple keys for inter-thread communication
So, what do Mach Ports give me that the above doesn't?
John Love
Touch the Future! Teach!
_______________________________________________
Cocoa-dev mailing list (email@hidden)
Please do not post admin requests or moderator comments to the list.
Contact the moderators at cocoa-dev-admins(at)lists.apple.com
Help/Unsubscribe/Update your Subscription:
This email sent to email@hidden