Created
January 13, 2018 21:31
-
-
Save sunho/a349a69eb6e790e380687731ce88250f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| func (vm *VM) newThread() *thread { | |
| s := &stack{RWMutex: new(sync.RWMutex)} | |
| cfs := &callFrameStack{callFrames: []callFrame{}} | |
| t := &thread{stack: s, callFrameStack: cfs, sp: 0, cfp: 0} | |
| s.thread = t | |
| cfs.thread = t | |
| t.vm = vm | |
| return t | |
| } |
Author
Author
mySlice1 := make([]int, 0)
mySlice2 := []int{}
are equivalent
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
t := &thread{stack: s, callFrameStack: cfs, sp: 0, cfp: 0}
s.thread = t
cfs.thread = t
mutually referring objects like this is not a bad design