Instance Method

sendBeforeDate:

Attempts to send the message before aDate, returning YES if successful or NO if the operation times out.

Declaration

- (BOOL)sendBeforeDate:(NSDate *)date;

Parameters

aDate

The instant before which the message should be sent.

Return Value

YES if the operation is successful, otherwise NO (for example, if the operation times out).

Discussion

If an error other than a time out occurs, this method could raise an NSInvalidSendPortException, NSInvalidReceivePortException, or an NSPortSendException, depending on the type of send port and the type of error.

If the message cannot be sent immediately, the sending thread blocks until either the message is sent or aDate is reached. Sent messages are queued to minimize blocking, but failure can occur if multiple messages are sent to a port faster than the port’s owner can receive them, causing the queue to fill up. Therefore, select a value for aDate that provides enough time for the message to be processed before the next message is sent. See the NSPort class specification for information on receiving a port message.