Copyright ©1995 by NeXT Computer, Inc.  All Rights Reserved.


Inherits From: NXInvalidationNotifier : Object
Conforms To: NXReference (through NXInvalidationNotifier)
NXTransport (Distributed Objects)
Declared In: machkit/NXPort.h

Class Description

The NXPort class provides an object-oriented interface to Mach ports.  NXPort objects are used by the Distributed Objects system whenever a Mach port is needed.

Instance Variables

port_t machPort;

machPort The Mach port managed by the NXPort

Adopted Protocols

NXReference addReference
NXTransport encodeRemotelyFor:freeAfterEncoding:isBycopy:

Method Types

Creating an NXPort + new
+ newFromMachPort:
+ newFromMachPort:dealloc:
Freeing an NXPort free
Listening for port deaths + worryAboutPortInvalidation
Getting the Mach port machPort
Hash-table value for the port hash

Class Methods

+ new

Creates and returns a new NXPort instance.  This method allocates a new Mach port that will be deallocated when the instance is freed.

See also:  + newFromMachPort:, + newFromMachPort:dealloc:

+ newFromMachPort:(port_t)port

Creates and returns a new NXPort instance that wraps an existing port specified by portport will not be deallocated when the instance is freed.

See also:  + new, + newFromMachPort:dealloc:

+ newFromMachPort:(port_t)port dealloc:(BOOL)flag

Creates and returns a new NXPort instance that wraps an existing port specified by port.  If flag is YES, port will be deallocated when the instance is freed; otherwise, it won't be deallocated.

See also:  + new, + newFromMachPort:

+ worryAboutPortInvalidation

Forks a thread to listen for port deaths; this thread sleeps until a port dies.  If a port death occurs, any objects registered for invalidation notification receive a senderIsInvalid: message.  This is generally only useful in applications that don't use the Application Kit.

See also:  senderIsInvalid: (NXSenderIsInvalid protocol)

Instance Methods


Decrements the receiver's reference count, returning self if the reference count remains greater than 0.  If the reference count becomes 0, this method deallocates the receiver's storage and returns nil.

See also:  NXReference protocol

(unsigned int)hash

Returns a hash-table index for the NXPort.  This isn't generally useful.


Returns the NXPort's Mach port.  This can be useful if you need to pass the port to routines that deal with Mach ports rather than NXPorts.