PATH  Documentation > Mac OS X > Foundation Reference: Objective-C



Table of Contents

NSMachPort


Inherits from:
NSPort : NSObject
Conforms to:
NSCoding
(NSPort)
NSCopying (NSPort)
NSObject (NSObject)
Declared in:
Foundation/NSPort.h




Class Description


An NSMachPort is a concrete subclass of the abstract NSPort class. NSMachPort is an object wrapper for a Mach port.




Method Types


Creating instances
+ portWithMachPort:
- initWithMachPort:
Getting the Mach port
- machPort
Port monitoring
- removeFromRunLoop:forMode:
- scheduleInRunLoop:forMode:


Class Methods



portWithMachPort:

+ (NSPort *)portWithMachPort:(int)machPort

Returns an NSPort object that uses the Mach port machPort (which should be of type port_t cast to int). Creates the NSPort object if necessary. Depending on the access rights for machPort, the new NSPort may only be able to send messages.


Instance Methods



initWithMachPort:

- (id)initWithMachPort:(int)machPort

Initializes a newly allocated NSMachPort object to use the Mach port machPort (which should be of type port_t cast to int). Depending on the access rights for machPort, the new NSMachPort may only be able to send messages. If a port with machPort already exists, deallocates the receiver, then retains and returns the existing NSMachPort.

This method is the designated initializer for the NSMachPort class. Returns self.



machPort

- (int)machPort

Returns as an int the Mach port used by the NSMachPort. Cast this value to a port_t when using it with Mach system calls.

removeFromRunLoop:forMode:

- (void)removeFromRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode

This method should be implemented by a subclass to stop monitoring of a port when removed from a run loop.

See Also: - scheduleInRunLoop:forMode:



scheduleInRunLoop:forMode:

- (void)scheduleInRunLoop:(NSRunLoop *)runLoop forMode:(NSString *)mode

This method should be implemented by a subclass to setup monitoring of a port when added to a run loop.

See Also: - removeFromRunLoop:forMode:




Table of Contents