Skip to content

Conversation

@dozyc
Copy link

@dozyc dozyc commented May 16, 2022

Organize code to show the symmetry between unlock and lock.

Lock and unlock each have check, action, update pattern, emphasized here.

The two exceptions now have more info on the source of the error.

Using 'level' instead of 'hierarchical_value' helps quickly and simply convey meaning.

Using 'level' allows for better variable names like 'instance_level' and 'thread_level'

Organize code to show the symmetry between unlock and lock.

Lock and unlock each have check, action, update pattern, emphasized here.

The two exceptions now have more info on the source of the error.

Using 'level' instead of 'hierarchical_value' helps quickly and simply convey meaning.

Using 'level' allows for better variable names like 'instance_level' and 'thread_level'
@dozyc
Copy link
Author

dozyc commented May 16, 2022

This change also motivates some updates to the accompanying text, but I think those changes confer more clarity there, too. I suggest replacing all instances of "hierarchy value" with "hierarchy level". The word "level" implies that relative magnitude is important, where "value" does not.

Some other recommendations for to the text:

The key here is the use of the static thread_local value...

The static-ness is as key as thread_local, since this gives the cross-instances property.

each thread has its own copy

Here, each is a little better to emphasize the way the threads have their own copy.

In order to avoid the hierarchy being violated due to out-of-order unlocking

Here, using violated ties to the relevant function names.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant