Home  /  Autodocs  /  exec.library

NAME

FindPort
find a given system message port

SYNOPSIS

port = FindPort(name)
D0 A1

struct MsgPort *FindPort(STRPTR);

FUNCTION

This function will search the system message port list for a port with the given name. The first port matching this name will be returned. No arbitration of the port list is done. This function MUST be protected with A Forbid()/Permit() pair!

EXAMPLE

#include <proto/exec.h>

ULONG SafePutToPort(struct Message * message, STRPTR portname)
{
struct MsgPort *port;

Forbid();

port = FindPort(portname);
if (port != NULL)
PutMsg(port, message);

Permit();

return (ULONG)port; /* If zero, the port has gone away */
}

INPUTS

name
name of the port to find

RETURN

port
a pointer to the message port, or zero if not found.

SEE ALSO

Forbid(), Permit()