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

Minor cleanup with concurrency and locking #26

Merged
merged 1 commit into from
Jun 21, 2018
Merged

Conversation

abhi
Copy link
Member

@abhi abhi commented Jun 20, 2018

Signed-off-by: Abhinandan Prativadi abhi@docker.com

@codecov-io
Copy link

codecov-io commented Jun 20, 2018

Codecov Report

Merging #26 into master will increase coverage by 1.09%.
The diff coverage is 71.42%.

Impacted file tree graph

@@            Coverage Diff             @@
##           master      #26      +/-   ##
==========================================
+ Coverage   40.46%   41.55%   +1.09%     
==========================================
  Files           8        8              
  Lines         304      296       -8     
==========================================
  Hits          123      123              
+ Misses        152      144       -8     
  Partials       29       29
Impacted Files Coverage Δ
opts.go 16.19% <ø> (-0.34%) ⬇️
cni.go 64.06% <71.42%> (+1.15%) ⬆️

Continue to review full report at Codecov.

Legend - Click here to learn more
Δ = absolute <relative> (impact), ø = not affected, ? = missing data
Powered by Codecov. Last update 47457ea...1695039. Read the comment docs.

@Random-Liu
Copy link
Member

Random-Liu commented Jun 21, 2018

I understand embedded RLock has no problem, but I still prefer having a separate status helper function which doesn't grab a lock, and change all public functions to use it.

Other than this LGTM.

@abhi
Copy link
Member Author

abhi commented Jun 21, 2018

@Random-Liu yes. The only reason is between status check and the actual setup we might have an update so It might be better to avoid the race by the embedded RLock is what I think.

@Random-Liu
Copy link
Member

@abhi I mean you can have an internal status function which doesn't have lock, and change Status, Setup, and Remove to use the internal status. In this way, you don't need embedded RLock and get the same result.

Signed-off-by: Abhinandan Prativadi <abhi@docker.com>
@abhi
Copy link
Member Author

abhi commented Jun 21, 2018

@Random-Liu done

@Random-Liu
Copy link
Member

LGTM

@abhi abhi merged commit 5882530 into containerd:master Jun 21, 2018
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.

None yet

3 participants