Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Only grab a read-lock in Now(). #4

Merged
merged 1 commit into from
Nov 21, 2015
Merged

Conversation

tsuna
Copy link
Contributor

@tsuna tsuna commented Nov 20, 2015

I can see two possible stances here:

  1. You consider the fakeClock non-performance sensitive test code, in which case we might just turn the RWMutex into a plain Mutex.
  2. You want to keep a RWMutex so that multiple callers can call Now() with less friction, in which case we should use RLock() / RUnlock().

I initially went with approach 1, somehow changed my mind for 2, but could be convinced either way.

@jonboulle
Copy link
Owner

Good spot. This is definitely my preferred approach. Thanks for the patch!

jonboulle added a commit that referenced this pull request Nov 21, 2015
Only grab a read-lock in Now().
@jonboulle jonboulle merged commit ed104f6 into jonboulle:master Nov 21, 2015
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.

2 participants