You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
typeGoExprstruct {
Value value.Any
}
// Eval forks the given context to get a child context and launches goroutine// with the child context to evaluate the Value.func (geGoExpr) Eval(ctx*Context) (value.Any, error) {
child:=ctx.fork()
p:=Promise{
val: make(chan value.Any, 1)
err: make(chanerror, 1)
}
gofunc() {
// N.B.: we don't need to close any of the channels (see note below).ifval, err:=child.Eval(ge.Value); err!=nil {
p.err<-err// non-blocking due to buffer
} else {
p.val<-val
}
}()
returnnil, nil
}
typePromisestruct{
// both channels are buffered (len=1)valchan value.Anyerrchanerror
}
(pPromise) Eval(ctx*Context) (value.Any, err) { returnp, nil }
(pPromise) Invoke(ctx*Context, args...value.Any) (valvalue.Any, errerror) {
select {
caseval=<-p.valcaseerr=<-p.err
}
return
}
The text was updated successfully, but these errors were encountered:
Concurrency primitives need to be decided.
Consider:
The text was updated successfully, but these errors were encountered: