custom_msg rcv and snd
This commit is contained in:
parent
448e62b13d
commit
ecddeb7bc9
|
@ -1,22 +1,32 @@
|
|||
#include <custom_msg.h>
|
||||
#include <sys/msg.h>
|
||||
|
||||
void rcvMsg(msg_t *msg) {
|
||||
if (msgrcv(_MSGQID, msg, sizeof(msg_t) - sizeof(long), 1, 0) == -1) {
|
||||
void msgRcv(void *msgp, size_t size, long mtype) {
|
||||
if (msgrcv(_MSGQID, msgp, size, mtype, 0) == -1) {
|
||||
errExitMsg("msgrcv");
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
void rcvMsg(msg_t *msg) {
|
||||
msgRcv(msg, sizeof(msg_t) - sizeof(long), 1);
|
||||
|
||||
}
|
||||
|
||||
void rcvMove(move_t *move) {
|
||||
msgRcv(_MSGQID, , sizeof() - sizeof(long), , 0);
|
||||
if (msgrcv(_MSGQID, move, sizeof(move_t) - sizeof(long), 2, 0) == -1) {
|
||||
errExitMsg("msgrcv");
|
||||
}
|
||||
}
|
||||
void rcvPlayer(player_ds *player) {
|
||||
msgRcv(_MSGQID, , sizeof() - sizeof(long), , 0);
|
||||
if (msgrcv(_MSGQID, player, sizeof(player_ds) - sizeof(long), 3, 0) == -1) {
|
||||
errExitMsg("msgrcv");
|
||||
}
|
||||
}
|
||||
void rcvGame_end(game_end_t *game) {
|
||||
msgRcv(_MSGQID, , sizeof() - sizeof(long), , 0);
|
||||
if (msgrcv(_MSGQID, game, sizeof(game_end_t) - sizeof(long), 4, 0) == -1) {
|
||||
errExitMsg("msgrcv");
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue