aboutsummaryrefslogtreecommitdiffstats
path: root/P2
diff options
context:
space:
mode:
authorMatt Strapp <strap012@umn.edu>2020-11-03 08:29:03 -0600
committerMatt Strapp <strap012@umn.edu>2020-11-03 08:29:03 -0600
commit9716c0ea250451f345780e79269e20603ca92382 (patch)
tree607c6e403d2d0b36c09ec4f132254bffb778731c /P2
parenthelp me (diff)
downloadcsci4061-9716c0ea250451f345780e79269e20603ca92382.tar
csci4061-9716c0ea250451f345780e79269e20603ca92382.tar.gz
csci4061-9716c0ea250451f345780e79269e20603ca92382.tar.bz2
csci4061-9716c0ea250451f345780e79269e20603ca92382.tar.lz
csci4061-9716c0ea250451f345780e79269e20603ca92382.tar.xz
csci4061-9716c0ea250451f345780e79269e20603ca92382.tar.zst
csci4061-9716c0ea250451f345780e79269e20603ca92382.zip
commenting things out
Diffstat (limited to 'P2')
-rw-r--r--P2/lib/utils.c18
1 files changed, 7 insertions, 11 deletions
diff --git a/P2/lib/utils.c b/P2/lib/utils.c
index 8c578a0..297b72e 100644
--- a/P2/lib/utils.c
+++ b/P2/lib/utils.c
@@ -17,18 +17,19 @@ struct msgBuffer makeMessage() {
char *getChunkData(int mapperID) {
//Message
struct msgBuffer message = makeMessage();
+ // printf("%ld\n", message.msgType);
//Queue ID
int mid = openQueue("map");
- printf("%d\n", mapperID);
+ // printf("%d\n", mapperID);
msgrcv(mid, &message, chunkSize, mapperID, 0);
- printf("\n%s\n", message.msgText);
- printf("%d\n", strncmp("END", message.msgText, 3));
+ // printf("\n%s\n", message.msgText);
+ // printf("%d\n", strncmp("END", message.msgText, 3));
if (strncmp("END", message.msgText, 3) == 0)
{
return NULL;
}
char* value = message.msgText;
- printf("%s\n", message.msgText);
+ // printf("%s\n", message.msgText);
printf("%s\n", value);
return value;
//return &(message.msgText);
@@ -55,6 +56,7 @@ void sendChunkData(char *inputFile, int nMappers) {
//The first mapper sent to is 2 instead of 1.
//Is this a problem? Probably not.
message.msgType = (map++ % nMappers) + 1;
+ printf("%s\n\n",message.msgText);
msgsnd(msgid, &message, map, 0);
}
@@ -85,13 +87,7 @@ int getInterData(char *Qkey, int reducerID) {
msgrcv(id, &message, chunkSize, reducerID, 0);
*Qkey = *message.msgText;
// printf("%s\n", Qkey);
- return abs(strncmp("END", message.msgText, 3));
- // if (strncmp("END", message.msgText, 3))
- // {
- // return 0;
- // } else {
- // return 1;
- // }
+ return strncmp("END", message.msgText, 3) == 0;
}
void shuffle(int nMappers, int nReducers) {