Skip to content
Projects
Groups
Snippets
Help
Loading...
Sign in
Toggle navigation
G
golang
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
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Open sidebar
go
golang
Commits
bed7e3ed
Commit
bed7e3ed
authored
Jul 29, 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
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
17 additions
and
4 deletions
+17
-4
cpuprof.c
src/pkg/runtime/cpuprof.c
+4
-0
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)
{
uintptr
*
p
;
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.
if
(
hz
<
0
)
...
...
src/pkg/runtime/symtab.c
View file @
bed7e3ed
...
...
@@ -420,10 +420,19 @@ runtime·findfunc(uintptr addr)
Func
*
f
;
int32
nf
,
n
;
runtime
·
lock
(
&
funclock
);
if
(
func
==
nil
)
buildfuncs
();
runtime
·
unlock
(
&
funclock
);
// Use atomic double-checked locking,
// because when called from pprof signal
// handler, findfunc must run without
// 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
)
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