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
93689d86
Commit
93689d86
authored
Oct 09, 2009
by
Russ Cox
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
keep a list of all the M's,
so that the garbage collector doesn't free them. R=ken OCL=35538 CL=35538
parent
d5c41427
Changes
2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
8 additions
and
1 deletion
+8
-1
src/pkg/runtime/proc.c
src/pkg/runtime/proc.c
+6
-1
src/pkg/runtime/runtime.h
src/pkg/runtime/runtime.h
+2
-0
No files found.
src/pkg/runtime/proc.c
View file @
93689d86
...
@@ -11,7 +11,6 @@ M m0;
...
@@ -11,7 +11,6 @@ M m0;
G
g0
;
// idle goroutine for m0
G
g0
;
// idle goroutine for m0
static
int32
debug
=
0
;
static
int32
debug
=
0
;
static
Lock
debuglock
;
// Go scheduler
// Go scheduler
//
//
...
@@ -96,6 +95,8 @@ schedinit(void)
...
@@ -96,6 +95,8 @@ schedinit(void)
{
{
int32
n
;
int32
n
;
byte
*
p
;
byte
*
p
;
allm
=
m
;
mallocinit
();
mallocinit
();
goargs
();
goargs
();
...
@@ -416,6 +417,10 @@ matchmg(void)
...
@@ -416,6 +417,10 @@ matchmg(void)
// Find the m that will run g.
// Find the m that will run g.
if
((
m
=
mget
(
g
))
==
nil
){
if
((
m
=
mget
(
g
))
==
nil
){
m
=
malloc
(
sizeof
(
M
));
m
=
malloc
(
sizeof
(
M
));
// Add to allm so garbage collector doesn't free m
// when it is just in a register (R14 on amd64).
m
->
alllink
=
allm
;
allm
=
m
;
m
->
g0
=
malg
(
8192
);
m
->
g0
=
malg
(
8192
);
m
->
id
=
sched
.
mcount
++
;
m
->
id
=
sched
.
mcount
++
;
...
...
src/pkg/runtime/runtime.h
View file @
93689d86
...
@@ -206,6 +206,7 @@ struct M
...
@@ -206,6 +206,7 @@ struct M
int32
waitnextg
;
int32
waitnextg
;
Note
havenextg
;
Note
havenextg
;
G
*
nextg
;
G
*
nextg
;
M
*
alllink
;
// on allm
M
*
schedlink
;
M
*
schedlink
;
Mem
mem
;
Mem
mem
;
uint32
machport
;
// Return address for Mach IPC (OS X)
uint32
machport
;
// Return address for Mach IPC (OS X)
...
@@ -307,6 +308,7 @@ struct Defer
...
@@ -307,6 +308,7 @@ struct Defer
extern
Alg
algarray
[
Amax
];
extern
Alg
algarray
[
Amax
];
extern
String
emptystring
;
extern
String
emptystring
;
G
*
allg
;
G
*
allg
;
M
*
allm
;
int32
goidgen
;
int32
goidgen
;
extern
int32
gomaxprocs
;
extern
int32
gomaxprocs
;
extern
int32
panicking
;
extern
int32
panicking
;
...
...
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