-
Notifications
You must be signed in to change notification settings - Fork 57
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Module4 homework ping pong #53
base: main
Are you sure you want to change the base?
Module4 homework ping pong #53
Conversation
sync with module3
sync module4 - conditional variables
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Doesn't work correctly for numOfReps = 1
ziobron@MBP:~/workspace/reveal.js/md.multithreading/module4$ ./plewa 1 100
Ping
Ping is finishing game. Num reps has reached 1
Game finished.
It was possible for me to end it with ping without a pong
Pong
Ping
Stop is finishing game - timeout.
Pong
Ping
on apple clang there is a data race - https://pastebin.pl/view/f5924827
but it's probably because of some differencies in stdlib. adding locks in if
s helps.
// TODO: wait to be used here + printing, reps incrementation, chainging turn to ping | ||
this_thread::sleep_for(500ms); | ||
opponentsTurn_.wait(l, [&] {return !isPingTurn_.load(); }); | ||
cout << "Pong" << endl; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
consecutive number is not printed
…multithreading into module4_homework_ping_pong
No description provided.