Most applications need to wait for a variety of messages and signals from a variety of sources. For example, an application might be waiting for Window events and also timer.device messages. In this case, an application must wait() on the combined signal bits of all signals it is interested in, including the signals for the message ports where any messages might arrive. The msgport structure, which is defined in <exec/ports.h>, is what exec uses to keep track of a message port. The userport field from the example above points to one of these structures. In this structure is a field called mp_sigbit, which contains the number (not the actual bit mask) of the message port's signal bit. To wait() on the signal of a message port, Wait() on a bit mask created by shifting 1L to the left mp_SigBit times (1L << msgport->mp_SigBit). The resulting bit mask can be OR'd with the bit masks for any other signals you wish to simultaneously wait on.