Skip to content
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

Thread-safe milestone requirements may result in concurrent modifications. #72

Open
diegovb opened this issue Oct 30, 2013 · 3 comments

Comments

@diegovb
Copy link

diegovb commented Oct 30, 2013

Milestone C in Restaurant v2.2 requires us to use either synchronized lists and exception catching to prevent concurrent modification exceptions, and we have to use both at least once.

I think this may result in problems because, for example, let's say we "protect" waiter's data by catching the exception in its scheduler. If the waiter's thread is modifying the data, and some other thread tries to modify it via a message, that would produce an exception in the other thread that wouldn't be caught unless it implemented the same method.

Am I correct? What should we do about this? Thanks!

@jakelow
Copy link

jakelow commented Oct 31, 2013

Prof W. will go over this in class. However, you are right that this could cause each thread to block each other. Bring up a scenario in class where this would happen and he will discuss it with the class.

@diegovb
Copy link
Author

diegovb commented Nov 1, 2013

What should we do about it for v2.2 then though?

@jakelow
Copy link

jakelow commented Nov 2, 2013

You can avoid the blocks by not including action calls in the synchronized sections of your code. however, the chances that your code will ever block are extremely low.

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

No branches or pull requests

2 participants