Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
K
k3s
Project
Project
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Registry
Registry
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jacklull
k3s
Commits
c393f112
Commit
c393f112
authored
Aug 04, 2016
by
Kubernetes Submit Queue
Committed by
GitHub
Aug 04, 2016
Browse files
Options
Browse Files
Download
Plain Diff
Merge pull request #29968 from ZTE-PaaS/zhangke-patch-014
Automatic merge from submit-queue optimize lock of runtimeState stuct use sync.RWMutex may be high effective for concorrent read
parents
353df208
e9b0454a
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
with
5 additions
and
5 deletions
+5
-5
runtime.go
pkg/kubelet/runtime.go
+5
-5
No files found.
pkg/kubelet/runtime.go
View file @
c393f112
...
@@ -23,7 +23,7 @@ import (
...
@@ -23,7 +23,7 @@ import (
)
)
type
runtimeState
struct
{
type
runtimeState
struct
{
sync
.
Mutex
sync
.
RW
Mutex
lastBaseRuntimeSync
time
.
Time
lastBaseRuntimeSync
time
.
Time
baseRuntimeSyncThreshold
time
.
Duration
baseRuntimeSyncThreshold
time
.
Duration
networkError
error
networkError
error
...
@@ -57,8 +57,8 @@ func (s *runtimeState) setPodCIDR(cidr string) {
...
@@ -57,8 +57,8 @@ func (s *runtimeState) setPodCIDR(cidr string) {
}
}
func
(
s
*
runtimeState
)
podCIDR
()
string
{
func
(
s
*
runtimeState
)
podCIDR
()
string
{
s
.
Lock
()
s
.
R
Lock
()
defer
s
.
Unlock
()
defer
s
.
R
Unlock
()
return
s
.
cidr
return
s
.
cidr
}
}
...
@@ -69,8 +69,8 @@ func (s *runtimeState) setInitError(err error) {
...
@@ -69,8 +69,8 @@ func (s *runtimeState) setInitError(err error) {
}
}
func
(
s
*
runtimeState
)
errors
()
[]
string
{
func
(
s
*
runtimeState
)
errors
()
[]
string
{
s
.
Lock
()
s
.
R
Lock
()
defer
s
.
Unlock
()
defer
s
.
R
Unlock
()
var
ret
[]
string
var
ret
[]
string
if
s
.
initError
!=
nil
{
if
s
.
initError
!=
nil
{
ret
=
append
(
ret
,
s
.
initError
.
Error
())
ret
=
append
(
ret
,
s
.
initError
.
Error
())
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment