mirror of
https://github.com/github/codeql.git
synced 2026-05-02 20:25:13 +02:00
Migrate Java code to separate QL repo.
This commit is contained in:
16
java/ql/src/Likely Bugs/Concurrency/InconsistentAccess.java
Normal file
16
java/ql/src/Likely Bugs/Concurrency/InconsistentAccess.java
Normal file
@@ -0,0 +1,16 @@
|
||||
class MultiThreadCounter {
|
||||
public int counter = 0;
|
||||
|
||||
public void modifyCounter() {
|
||||
synchronized(this) {
|
||||
counter--;
|
||||
}
|
||||
synchronized(this) {
|
||||
counter--;
|
||||
}
|
||||
synchronized(this) {
|
||||
counter--;
|
||||
}
|
||||
counter = counter + 3; // No synchronization
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user