Skip to content

Commit

Permalink
#17 goroutine: bugfix
Browse files Browse the repository at this point in the history
  • Loading branch information
xushiwei committed Apr 4, 2016
1 parent 3ac937d commit 852702c
Showing 1 changed file with 3 additions and 3 deletions.
6 changes: 3 additions & 3 deletions exec.v2/goroutine.go
Expand Up @@ -14,9 +14,9 @@ type iGo struct {
func (p *iGo) Exec(stk *Stack, ctx *Context) {

go func() {
fn := NewFunction(nil, p.start, p.end, nil, false)
fn.parent = ctx
fn.ExtCall(nil)
cloneCtx := *ctx // 每个goroutine需要自己的上下文,有自己的堆栈
cloneCtx.Stack = NewStack()
cloneCtx.Code.Exec(p.start, p.end, cloneCtx.Stack, &cloneCtx)
}()
stk.Push(nil)
}
Expand Down

0 comments on commit 852702c

Please sign in to comment.