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.. Thanks for the heads up though. It's not a big deal though, won't really edit that unless I plan on making other changes or add new features. |
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
-
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