4 msgqueue::msgqueue (
char *
token,
const int id,
5 int &
status,
const int inew )
10 tokenid = ftok ( token,
id);
14 ishmflg = 0666 | IPC_CREAT;
20 msgid = msgget(tokenid,ishmflg);
36 #if defined(SunOS) || defined(Linux)
38 msgctl (msgid, IPC_RMID,&msgb);
41 msgctl (msgid, IPC_RMID);
48 int msgqueue::receive(
struct msgbuf *structure,
int size)
50 return msgrcv(msgid, structure, size, 0, 0);
53 int msgqueue::receive_nowait(
struct msgbuf* structure,
int size)
55 return msgrcv(msgid, structure, size, 0, IPC_NOWAIT);
58 int msgqueue::send(
struct msgbuf * structure,
int size)
60 return msgsnd(msgid, structure, size, 0);
63 int msgqueue::wait_for_ping()
66 return msgrcv(msgid, (
struct msgbuf *) i, 8, 0, 0);
69 int msgqueue::send_ping()
75 return msgsnd(msgid, (
struct msgbuf *) i , 8, 0);