Skip to content

Conversation

@KevinBrack
Copy link

No description provided.

Copy link

@TheDeterminator TheDeterminator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kevin, your code looks good! Just a few suggestions for your issue on ex5. Good luck! Let me know if I can help with anything.

printf("Greetings from child (pid: %d)\n", f);
printf("Childs x: %i\n", x);
printf("Childs pointer to x: %p\n", xp);
printf("Childs pointer to x value: %i\n", *xp);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Nice, I like how you experiment with pointers here.

char* msg1 = "hello world #1";
char* msg2 = "hello world #2";
char* msg3 = "hello world #3";
char *msg1 = "hello world #1";

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I see you changed the spacing here, good. It's funny how something as small as spacing can give you clues about who the author of the code was.

Copy link
Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Oh. I love to use Prettier and format-on-save. As a highly visual learner it gives me a holistic impression of what good code should look like in each language.

ex5/ex5.c Outdated
// we are in the parent branch
for (int i = 0; i < 3; i++)
{
wait(NULL);

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Try taking your wait() call out of the for loop and see if that stops the program from hanging. You also might consider closing the "write" side fo the pipe with the close() call (also done outside of the for loop)although, I think that's less likely to be the issue.

Copy link

@TheDeterminator TheDeterminator left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Kevin, good job figuring out your issue with ex5. Everything here looks great! Let me know if you need anything.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants