From 17a50b7c500ef1094fda9ce0cfd58ba1102c29d8 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 1 Apr 2019 08:02:11 -0700 Subject: [PATCH] fix #171 (#172) --- runtime/vm.go | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/runtime/vm.go b/runtime/vm.go index ee05eb2c..dde52db5 100644 --- a/runtime/vm.go +++ b/runtime/vm.go @@ -80,6 +80,8 @@ func (v *VM) Run() (err error) { v.run() + atomic.StoreInt64(&v.aborting, 0) + err = v.err if err != nil { filePos := v.fileSet.Position(v.curFrame.fn.SourcePos(v.ip - 1)) @@ -115,7 +117,7 @@ func (v *VM) run() { } }() - for atomic.CompareAndSwapInt64(&v.aborting, 0, 0) { + for atomic.LoadInt64(&v.aborting) == 0 { v.ip++ switch v.curInsts[v.ip] {