Find a system message port by name
Source position: exec.pas line 1234
function FindPort( |
const name: pCHAR |
):pMsgPort; |
const name: string |
):pMsgPort; |
name |
|
Name of the message port to find. |
A pointer to the message port, or nil if not found.
name |
|
Name of the message port to find. |
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!
function SafePutToPort(Msg: PMessage; Portname: string): Integer; var Port: PMsgPort; PName: PChar; begin Result := -1; PName := PChar(Portname + #0); Forbid(); Port := FindPort(PName); if Assigned(Port) then begin PutMsg(Port, Msg); Result := 0; end; Permit(); end;