Created
September 14, 2011 05:02
-
-
Save koush/1215889 to your computer and use it in GitHub Desktop.
fuuuuck.java
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
new Thread() { | |
var entity = db.get('foo'); | |
// entity.siblings = [] due to race condition | |
entity.siblings.push('boo'); | |
// entity.siblings = ['boo'] | |
db.put('foo', entity); | |
// one of these puts overwrote the other... | |
}.start(); | |
new Thread() { | |
var entity = db.get('foo'); | |
// entity.siblings = [] due to race condition | |
entity.siblings.push('bar'); | |
// entity.siblings = ['bar'] | |
db.put('foo', entity); | |
// one of these puts overwrote the other... | |
}.start(); |
nah, i was just gisting something for a friend about atomicity of writes.
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
not synchronized ?