Any advice?
get rid of the global variables. Use channels instead. Share memory by communicating; don't communicate by sharing memory.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/4AW1Ss9Tjp0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/7b197eb6-775e-456b-abf9-30ab00becec9n%40googlegroups.com.
On May 5, 2022, at 11:55 AM, Brian Candler <b.ca...@pobox.com> wrote:
Correct.
--
You received this message because you are subscribed to the Google Groups "golang-nuts" group.
To unsubscribe from this group and stop receiving emails from it, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/38239c7c-2c62-45ef-85ad-3edeb26bda8bn%40googlegroups.com.
--
You received this message because you are subscribed to a topic in the Google Groups "golang-nuts" group.
To unsubscribe from this topic, visit https://groups.google.com/d/topic/golang-nuts/4AW1Ss9Tjp0/unsubscribe.
To unsubscribe from this group and all its topics, send an email to golang-nuts...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/golang-nuts/38239c7c-2c62-45ef-85ad-3edeb26bda8bn%40googlegroups.com.
I already know that a copy of map does not make a difference. That is why I put it inside a struct, but magic did not happen.
Does the sync.Map solves reading and writing conflict? For I checked the print out log and discovered that even `atomic` module did not prevent such race warnings.
There are also huge amount of warnings related to log4go module. But the author seemed to put a recovery patch to it,is it another way to solve it?Although every logging of `log4go` might trigger race panic, it survived a pressure test as each incoming quotation got logged and got logged again after reading it back from redis for 8 hours, which resulted a quotation log as large as tens of MB.
Hi Kurtis!Thanks for your reply.I am just stating the fact that atomic module did not solve the reading writing conflict as it may sound so, or Brian perceived so.
I definitely follow the syntax of atomic while writing inside the atomic.StoreInt64 function.But as for reading I used a simple `=`, and it obviously failed.
It seems that both reading and writing need special functions?In that way I do not believe the atomic module makes things simpler than my proposal.I did use sync.Map, and it did not raise such warnings. Maybe it is because I followed the strict reading and writing function syntax.
The log4go module raised lots of such race warnings, while in practice it endured high frequently logging and did not crash once.