home
***
CD-ROM
|
disk
|
FTP
|
other
***
search
/
Club Amiga de Montreal - CAM
/
CAM_CD_1.iso
/
files
/
372.lha
/
PopUpMenu_3.2
/
Source
/
PortStuff.c
< prev
next >
Wrap
C/C++ Source or Header
|
1990-05-06
|
952b
|
42 lines
#include "PopUpMenu.h"
/*+++++++++++++++++++++++++++++++++++++++++++++
+ CreatePort(Name, Pri)
+ DeletePort(Port)
+
+ Replacements for amiga.lib
+++++++++++++++++++++++++++++++++++++++++++++++*/
struct MsgPort *CreatePort(Name, Pri)
char *Name;
LONG Pri;
{
UBYTE SigBit;
if ((SigBit = AllocSignal(-1)) != -1) {
struct MsgPort *const Port = AllocMem(sizeof(struct MsgPort),
MEMF_CLEAR | MEMF_PUBLIC);
if (Port) {
Port->mp_Node.ln_Name = Name;
Port->mp_Node.ln_Pri = Pri;
Port->mp_Node.ln_Type = NT_MSGPORT;
Port->mp_Flags = PA_SIGNAL;
Port->mp_SigBit = SigBit;
Port->mp_SigTask = (struct Task *)FindTask(0);
AddPort(Port);
return(Port);
}
else
FreeSignal((LONG)SigBit);
}
return(NULL);
}
VOID DeletePort(Port)
struct MsgPort *const Port;
{
RemPort(Port);
FreeSignal((LONG)Port->mp_SigBit);
FreeMem(Port,sizeof(struct MsgPort));
}