Skip to content
Projects
Groups
Snippets
Help
Loading...
Help
Support
Keyboard shortcuts
?
Submit feedback
Contribute to GitLab
Sign in / Register
Toggle navigation
G
go
Project overview
Project overview
Details
Activity
Releases
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Issues
0
Issues
0
List
Boards
Labels
Milestones
Merge Requests
0
Merge Requests
0
Analytics
Analytics
Repository
Value Stream
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Create a new issue
Commits
Issue Boards
Open sidebar
Kirill Smelkov
go
Commits
bed7e3ed
Commit
bed7e3ed
authored
Jul 28, 2011
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
gc: fix pprof deadlock
Fixes #2051. R=golang-dev, dsymonds CC=golang-dev
https://golang.org/cl/4834041
parent
032ffb2e
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
src/pkg/runtime/cpuprof.c
src/pkg/runtime/cpuprof.c
+4
-0
src/pkg/runtime/symtab.c
src/pkg/runtime/symtab.c
+13
-4
No files found.
src/pkg/runtime/cpuprof.c
View file @
bed7e3ed
...
@@ -121,6 +121,10 @@ runtime·SetCPUProfileRate(int32 hz)
...
@@ -121,6 +121,10 @@ runtime·SetCPUProfileRate(int32 hz)
{
{
uintptr
*
p
;
uintptr
*
p
;
uintptr
n
;
uintptr
n
;
// Call findfunc now so that it won't have to
// build tables during the signal handler.
runtime
·
findfunc
(
0
);
// Clamp hz to something reasonable.
// Clamp hz to something reasonable.
if
(
hz
<
0
)
if
(
hz
<
0
)
...
...
src/pkg/runtime/symtab.c
View file @
bed7e3ed
...
@@ -420,10 +420,19 @@ runtime·findfunc(uintptr addr)
...
@@ -420,10 +420,19 @@ runtime·findfunc(uintptr addr)
Func
*
f
;
Func
*
f
;
int32
nf
,
n
;
int32
nf
,
n
;
runtime
·
lock
(
&
funclock
);
// Use atomic double-checked locking,
if
(
func
==
nil
)
// because when called from pprof signal
buildfuncs
();
// handler, findfunc must run without
runtime
·
unlock
(
&
funclock
);
// grabbing any locks.
// (Before enabling the signal handler,
// SetCPUProfileRate calls findfunc to trigger
// the initialization outside the handler.)
if
(
runtime
·
atomicloadp
(
&
func
)
==
nil
)
{
runtime
·
lock
(
&
funclock
);
if
(
func
==
nil
)
buildfuncs
();
runtime
·
unlock
(
&
funclock
);
}
if
(
nfunc
==
0
)
if
(
nfunc
==
0
)
return
nil
;
return
nil
;
...
...
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