What would be a best and simple way of storing incoming message from different processes in an array in C? I was thinking to have an array MQ but also need to store message sequence numbers and process ids for each incoming message. Thanks.
1 Answer
It sounds like you want to have an array of structures that contain the various elements that you want to store, e.g.
struct MessageInfo {
int message_id;
pid_t incoming_pid;
char message_data[MAX_MESSAGE_LEN];
};
struct MessageInfo message_queue[MAX_QUEUE_LEN];
1 Comment
stefan
Yeah, depends if he is asking about the actually structure or about thread safety part.