AMX Message Exchange Manager
K
A
DAK
117
void cdecl sttask(void) /* Common task body */
{union msgu msgbuf; /* Message buffer */
int status;
/* Wait at priority 0 for */
/* up to 5 sec for message */
status = ajmxwat(msgexch, &msgbuf, ajtmcnv(5000), 0);
if (status == AEROK) {
:
Process the message in msgbuf.umsg
:
}
else if (status == AERTMO) {
:
Process timeout - no message in 5 seconds
:
}
else { Message retrieval failed
Process some other error condition
}
}
void cdecl sttaskA(void) /* Task A */
{for (;;) sttask(); /* Do sttask forever */
}
void cdecl sttaskB(void) /* Task B */
{for (;;) sttask(); /* Do sttask forever */
}