Uninformed: Informative Information for the Uninformed

Vol 4» 2006.Jun

Next: Ports Up: Basic Concepts Previous: Threads   Contents


Messages are used in Mach in order to provide communicate between threads. A message is made up of a collection of data objects. Once a message is created it is sent to a port for which the invoking task has the appropriate port rights. Port rights can be sent between tasks as a message. Messages are queued at the destination and processed at the liberty of the receiving thread.

On Mac OS X, the mach_msg() function be used to send and receive messages to and from a port. The declaration for this function is shown below.

	mach_msg_return_t   mach_msg
			    (mach_msg_header_t                msg,
			     mach_msg_option_t             option,
			     mach_msg_size_t            send_size,
			     mach_msg_size_t        receive_limit,
			     mach_port_t             receive_name,
			     mach_msg_timeout_t           timeout,
			     mach_port_t                   notify);