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

    CreatePort - Allocate and initialize a new message port

    port = CreatePort(name,pri)

    struct MsgPort *CreatePort(STRPTR,LONG);

    Allocates and initializes a new message port. The message list
    of the new port will be prepared for use (via NewList).  A signal
    bit will be allocated, and the port will be set to signal your
    task when a message arrives (PA_SIGNAL).

    You *must* use DeletePort() to delete ports created with

    name - public name of the port, or NULL if the port is not named.
           The name string is not copied. Most ports do not need names,
           see notes below on this.
    pri  - Priority used for insertion into the public port list,
           normally 0.

    port - a new MsgPort structure ready for use, or NULL if the port
           could not be created due to not enough memory or no available
           signal bit.

    In most cases, ports should not be named. Named ports are used for
    rendez-vous between tasks. Everytime a named port needs to be located,
    the list of all named ports must be traversed. The more named
    ports there are, the longer this list traversal takes. Thus, unless
    you really need to, do not name your ports, which will keep them off
    of the named port list and improve system performance.

    With versions of amiga.lib prior to V37.14, this function would
    not fail even though it couldn't allocate a signal bit. The port
    would be returned with no signal allocated.

    DeletePort(), exec.library/FindPort(), <exec/ports.h>,

[Back to Amiga Developer Docs]