Skip to content

Instantly share code, notes, and snippets.

@awreece
Last active August 29, 2015 14:06
Show Gist options
  • Save awreece/c4a2d8e28b7da00aa3e2 to your computer and use it in GitHub Desktop.
Save awreece/c4a2d8e28b7da00aa3e2 to your computer and use it in GitHub Desktop.
spot the bug 2013
def swap(threaded_array, i, j):
threaded_array.locks[i].lock()
threaded_array.locks[j].lock()
threaded_array.data[i], threaded_array.data[j] = \
threaded_array.data[j], threaded_array.data[i]
threaded_array.locks[j].unlock()
threaded_array.locks[i].unlock()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment