Topic : The ATARI Compendium
Author : Scott Sanders / JAY Software
Version : 1.25 (20/6/2003)
Subject : Documentation
Nodes : 1117
Index Size : 32614
HCP-Version : 6
Compiled on : Atari
@charset : UTF-8
@lang : en
@default :
@help : %About
@options : +g -i -t4 +y +z
@width : 100
View Ref-FilePmsg() GEMDOSSyntaxWORD Pmsg( mode, mboxid, msgptr )
WORD mode;
LONG mboxid;
PMSG *msgptr;
Function Pmsg() sends/receives a message to/from a 'message box'.
Opcode 293 (0x125)
Availability Available when a 'MiNT' cookie with a version of at least
0.90 exists.
Parameters mode specifies the action to take as follows:
Name mode Operation
MSG_READ 0 Block the process and don't return until
a message is read from the specified
mailbox ID mboxid and placed in the
structure pointed to by msgptr.
MSG_WRITE 1 Block the process and don't return until
a process waiting for a message with
mailbox ID mboxid has received the
message contained in the structure
pointed to by msgptr.
MSG_READWRITE 2 Block the process until a process
waiting for a message with mailbox ID
mboxid has received the message
contained in the structure pointed to by
msgptr and a return message is received
with mailbox ID 0xFFFFxxxx where 'xxxx'
is the process ID of the current
process.
PMSG is defined as:
typedef struct
{
LONG userlong1;
LONG userlong2;
WORD pid;
} PMSG;
On return from writes, pmsg.pid contains the process ID of
the process who read your message, on return from reads, its
the process ID of the writer. The contents of userlong1 and
userlong2 is completely up to the sender. By OR'ing mode with
MSG_NOWAIT (0x8000), you can prevent the call from blocking
the process and simply return -1 if another process wasn't
waiting to read or send your process a message.
Binding pea msgptr
move.l mboxid,-(sp)
move.w mode,-(sp)
move.w #$125,-(sp)
trap #1
lea 12(sp),sp
Return Value Pmsg() returns 0 if successful, -1 if bit 0x8000 is set and
no process was ready to receive/send the desired message, or
a negative GEMDOS error code.