[Contents] [Index] [Help] [Retrace] [Browse <] [Browse >]


   NAME
        AddPort -- add a public message port to the system

   SYNOPSIS
        AddPort(port)
                A1

        void AddPort(struct msgport *);

   FUNCTION
        This function attaches a message port structure to the system's
        public message port list, where it can be found by the findport()
        function.  The name and priority fields of the port structure must
        be initialized prior to calling this function.  If the user does
        not require the priority field, it should be initialized to zero.

        Only ports that will be searched for with findport() need to
        be added to the system list.  In addition, adding ports is often
        useful during debugging.  If the port will be searched for,
        the priority field should be at least 1 (to avoid the large number
        of inactive ports at priority zero).  If the port will be searched
        for often, set the priority in the 50-100 range (so it will be
        before other less used ports).

        Once a port has been added to the naming list, you must be careful
        to remove the port from the list (via RemPort) before deallocating
        its memory.

   NOTE
        A point of confusion is that clearing a msgport structure to all
        zeros is not enough to prepare it for use.  As mentioned in the
        Exec chapter of the ROM Kernel Manual, the list for the msgport
        must be initialized.  This is automatically handled by AddPort(),
        and amiga.lib/createport.  this initialization can be done manually
        with amiga.lib/newlist or the assembly newlist macro.

        Do not AddPort an active port.

   INPUTS
        port - pointer to a message port

   SEE ALSO
        remport(), findport(), amiga.lib/createport(), amiga.lib/newlist()