-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
d305ae5
commit 17a52ff
Showing
12 changed files
with
80 additions
and
785 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -6,4 +6,5 @@ CMakeSettings.json | |
.vs/ | ||
.vscode/ | ||
log/ | ||
runtime/ | ||
runtime/ | ||
*.bak |
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,53 @@ | ||
// This class manages POSIX mqueue creation and destruction | ||
|
||
#ifndef MSG_QUEUE | ||
#define MSG_QUEUE | ||
|
||
#include <stdio.h> | ||
#include <cstdlib> | ||
#include <mqueue.h> | ||
|
||
class msgQueue | ||
{ | ||
private: | ||
mqd_t MQ_; | ||
const char *qName_; | ||
|
||
public: | ||
msgQueue(const char *, int, int, int); | ||
const mqd_t getMQ() { return MQ_; } | ||
int getAttr(struct mq_attr *attr) { return mq_getattr(MQ_, attr); } | ||
~msgQueue(); | ||
}; | ||
|
||
msgQueue::msgQueue(const char *name, int flags, int maxmsg, int msgsize) : qName_{name} | ||
{ | ||
struct mq_attr attr; | ||
attr.mq_flags = 0; /* Flags (ignored for mq_open()) */ | ||
attr.mq_maxmsg = maxmsg; | ||
attr.mq_msgsize = msgsize; | ||
|
||
MQ_ = mq_open(qName_, flags, 0664, &attr); | ||
|
||
if (this->MQ_ < 0) | ||
{ | ||
printf("mq_open failed\n"); | ||
exit(1); | ||
} | ||
} | ||
|
||
msgQueue::~msgQueue() | ||
{ | ||
if (mq_close(MQ_) < 0) | ||
{ | ||
printf("mq_close failed\n"); | ||
exit(1); | ||
} | ||
if (mq_unlink(qName_) < 0) | ||
{ | ||
printf("mq_unlink failed\n"); | ||
exit(1); | ||
} | ||
} | ||
|
||
#endif |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.