Mutex in Spaceflake struct #6
gruzovator
started this conversation in
General
Replies: 1 comment 1 reply
-
|
Ah yeah right, don't know why I created a Mutex at the same place where I lock it; pretty useless. Mutex should be created when creating a new worker and then using that one I suppose.. |
Beta Was this translation helpful? Give feedback.
1 reply
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Could you please explain why a mutex is needed in this code:
This mutex doesn't guard w.increment cause every call of GenerateSpaceflakeAt creates a new mutex.
Maybe the mutex is not needed here at all if a 'worker' has one goroutine.
Thank you
Beta Was this translation helpful? Give feedback.
All reactions