Skip to content

Instantly share code, notes, and snippets.

@mkusher
Created June 29, 2014 21:04
Show Gist options
  • Save mkusher/ba4cd9cf3bb716af934a to your computer and use it in GitHub Desktop.
Save mkusher/ba4cd9cf3bb716af934a to your computer and use it in GitHub Desktop.
#include <sys/types.h>
#include <sys/ipc.h>
#include <sys/msg.h>
#include "queue.h"
Queue::Queue(char * pathname, int flags, int uniq){
key_t key = ftok(pathname, uniq);
id = msgget(key, flags);
this->flags = flags;
}
int Queue::send(void* buf, int length){
return msgsnd(id, buf, length, 0);
}
int Queue::receive(void* buf, int length, int type){
return msgrcv(id, buf, length, type, 0);
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment