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

scope is broken again for datarace and --atomicity=true #23

Open
andrecostea opened this issue Aug 29, 2020 · 0 comments
Open

scope is broken again for datarace and --atomicity=true #23

andrecostea opened this issue Aug 29, 2020 · 0 comments

Comments

@andrecostea
Copy link
Collaborator

Patch ID: 2
Replace (INSERT) lines: 6 - 41
+: Object objR1 = new Object();
Replace (INSERT) lines: 39 - 39
-: return accounts[accountNumber].getBalance() == amount;
+: synchronized(objR1) { return accounts[accountNumber].getBalance() == amount; }

Replace (INSERT) lines: 31 - 33
-: int temp = accounts[accountNumber].getBalance();
temp = temp + amount;
accounts[accountNumber].setBalance(temp);
+: synchronized(objR1) { int temp = accounts[accountNumber].getBalance();
temp = temp + amount;
accounts[accountNumber].setBalance(temp); }

Replace (INSERT) lines: 23 - 25
-: int temp = accounts[accountNumber].getBalance();
temp = temp - amount;
accounts[accountNumber].setBalance(temp);
+: synchronized(objR1) { int temp = accounts[accountNumber].getBalance();
temp = temp - amount;
accounts[accountNumber].setBalance(temp); }

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

1 participant