aboutsummaryrefslogtreecommitdiffstats
path: root/P2/lib
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-10-28 17:46:47 -0500
committerMatt Strapp <strap012@umn.edu>2020-10-28 17:46:47 -0500
commit989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c (patch)
tree0a4ca5bbc8477bce4ab934922510c4fddfd125a7 /P2/lib
parentI broke it again (diff)
downloadcsci4061-989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c.tar
csci4061-989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c.tar.gz
csci4061-989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c.tar.bz2
csci4061-989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c.tar.lz
csci4061-989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c.tar.xz
csci4061-989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c.tar.zst
csci4061-989c6b2e91a7d304f68f9f5997e7dae0e5f53b6c.zip
Add closequeue
Diffstat (limited to 'P2/lib')
-rw-r--r--P2/lib/utils.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index ede4931..8c27f4c 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -2,13 +2,20 @@
int openQueue() {
int id = msgget(ftok("4061 Project 2 SS", 'S'), 0666 | IPC_CREAT);
- if (id < 0)
- {
+ if (id < 0) {
perror("Cannot open queue.\n");
return -1;
- };
+ }
return id;
}
+void closeQueue() {
+ int msgid = msgget(ftok("4061 Project 2 SS", 'S'), 0666);
+ if (msgid < 0) {
+ perror("Cannot open queue. It may already exist.\n");
+ exit(-1);
+ }
+ msgctl(msgid, IPC_RMID, NULL);
+}
char *getChunkData(int mapperID) {
printf("GETTING CHUNK DATA\n");