Skip to content

Instantly share code, notes, and snippets.

@awreece
Created June 25, 2013 05:38
Show Gist options
  • Save awreece/5856175 to your computer and use it in GitHub Desktop.
Save awreece/5856175 to your computer and use it in GitHub Desktop.
# My pseudocode always looks like python.
lock_index = get_lock_index(hash_table_index)
if lock_index < find_first_set(lock_bitvector):
for bit_index set in lock_bitvector:
locks[bit_index].unlock()
lock(locks[lock_index])
for bit_index set in lock_bitvector:
locks[bit_index].lock()
else:
locks[lock_index].lock()
lock_bitvector |= (1 << lock_index)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment