summaryrefslogtreecommitdiff
path: root/docs/html/sdk/api_diff/21/changes
diff options
context:
space:
mode:
authorHugo Benichi <hugobenichi@google.com>2016-10-04 11:24:12 +0900
committerHugo Benichi <hugobenichi@google.com>2016-10-13 15:00:34 +0900
commitb0f1186c034c4df9eb54ed29944d16ce6d7ade56 (patch)
tree6ce134221ac13b843ebb9705b3f452a9e8d1fe6d /docs/html/sdk/api_diff/21/changes
parentdaeeda35d951e9b6925a98cd0d909a59a94bd59f (diff)
Do not synchronize boolean reads/writes
This patch removes the synchronization around the private variable mRunning inside of IpReachabilityMonitor and instead qualifeis the field as volatile. Synchronization is not needed for reads/writes on native fields or object references because they are already guaranteed to be atomic. Synchronization here was used for enforcing memory visibility across concurrent threads indirectly through monitor acquire/release. The volatile keyword achieves this in a more explicit way. Also, this patch changes the way that probeAll() copies the IpReachabilityMonitor's mIpWatchList by temporary holding mIpWatchList keys into an ArrayList instead of a more expensive HashSet. Since Java HashSet are just degenerated HashMaps, and that key iteration order is based on key hash, the iteration order over this temporary collection will be consistent for the same mIpWatchList. Test: refactoring CL. Existing unit tests still pass. Change-Id: I86ca6d54cb41ec78281e224a8d8ffd7155451132
Diffstat (limited to 'docs/html/sdk/api_diff/21/changes')
0 files changed, 0 insertions, 0 deletions