Add mailbox struct to mailbox.h

master
Nick Krichevsky 2019-09-21 19:31:21 -04:00
parent b09bb99212
commit df7caa3f56
1 changed files with 12 additions and 0 deletions

View File

@ -1,8 +1,11 @@
#ifndef MAILBOX_H
#define MAILBOX_H
#include <semaphore.h>
struct msg {
// index of thread that sent the message
// if iFrom is -1, then the message is considered invalid.
int iFrom;
// value of message
int value;
@ -12,4 +15,13 @@ struct msg {
int tot;
};
struct mailbox {
// the current message in the mailbox
struct msg stored_message;
// represents whether or not a message can be sent
sem_t send_sem;
// represents whether or not a message can be receieved
sem_t recv_sem;
};
#endif