use sync.RWMutex when masterNode changes #79

Merged
merged 1 commit into from Feb 4, 2015

Projects

None yet

2 participants

@chrislusf
Owner

Even the race happens, it would not impact the system since it's in a transition period.

However, I still do not see it's possible to have any data race related error related to this. It's just changing a string pointer, which is one cpu operation. But I do not know much about Go deep internals. Having a reproducible test case would be more convincing.

@yanyiwu
Contributor
yanyiwu commented Feb 4, 2015

Even the race happens, it would not impact the system since it's in a transition period.
When the race happens, your process will be dead.

  1. It's just changing a string pointer, which is one cpu operation. You mean a pointer change is atomic operation ? Are you sure ?

I just hope this project to be more stable, avoid potential error happening.
But now that you really think it is no need to do it, so let's forget it and move on.

@yanyiwu yanyiwu closed this Feb 4, 2015
@chrislusf
Owner

Looks like you are winning on the mailing list. Reopening this. But it still has compilation error. Please check again.

@chrislusf chrislusf reopened this Feb 4, 2015
@yanyiwu
Contributor
yanyiwu commented Feb 4, 2015

Now it's ok.

@chrislusf chrislusf merged commit 75f4964 into chrislusf:master Feb 4, 2015

1 check passed

continuous-integration/travis-ci The Travis CI build passed
Details
@chrislusf
Owner

Try to use atomic.Value to simplify this if possible.

@yanyiwu
Contributor
yanyiwu commented Feb 4, 2015

Nice suggestion, but I am not familiar with atomic.Value, maybe someone else can do it.

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