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

light: use atomic type #27169

Merged
merged 2 commits into from
Apr 26, 2023
Merged

light: use atomic type #27169

merged 2 commits into from
Apr 26, 2023

Conversation

stephenfire
Copy link
Contributor

use atomic.Bool for switches in light.LightChain

Copy link
Contributor

@holiman holiman left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM

@holiman holiman added this to the 1.11.7 milestone Apr 26, 2023
@@ -302,7 +302,7 @@ func (lc *LightChain) GetBlockByNumber(ctx context.Context, number uint64) (*typ
// Stop stops the blockchain service. If any imports are currently in progress
// it will abort them using the procInterrupt.
func (lc *LightChain) Stop() {
if !atomic.CompareAndSwapInt32(&lc.running, 0, 1) {
if !lc.running.CompareAndSwap(false, true) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This variable name is weird. Perhaps stopped is more suitable.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for the reminder, it has been modified.

@holiman holiman merged commit 306d177 into ethereum:master Apr 26, 2023
@stephenfire stephenfire deleted the light_atomic branch April 26, 2023 09:15
shekhirin pushed a commit to shekhirin/go-ethereum that referenced this pull request Jun 6, 2023
* light: use atomic type

* light: use a suitable name for the stopped switch in LightChain
devopsbo3 pushed a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
* light: use atomic type

* light: use a suitable name for the stopped switch in LightChain
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
devopsbo3 added a commit to HorizenOfficial/go-ethereum that referenced this pull request Nov 10, 2023
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.

3 participants