custom_msg rcv and snd

This commit is contained in:
Lorenzo Bianchi 2023-05-18 14:32:47 +02:00
parent b39fe5f699
commit 1f42dedc9a
1 changed files with 9 additions and 1 deletions

View File

@ -2,7 +2,7 @@
#include <sys/msg.h>
void msgRcv(void *msgp, size_t size, long mtype) {
if (msgrcv(_MSGQID, msgp, size, mtype, 0) == -1) {
if (msgrcv(_MSGQID, msgp, size, mtype, 0) == -1) {
errExitMsg("msgrcv");
}
}
@ -22,6 +22,14 @@ void rcvGame_end(game_end_t *game) {
}
void msgSnd(void *msgp, size_t size, long mtype) {
if (msg(_MSGQID, msgp, size, mtype, 0) == -1) {
errExitMsg("msgrcv");
}
}
void sndMsg(msg_t *msg) {
if (msgsnd(_MSGQID, msg, sizeof(msg_t) - sizeof(long), 0) == -1) {
errExitMsg("msgsnd");