Skip to content
This repository was archived by the owner on Feb 8, 2021. It is now read-only.
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions hypervisor/hypervisor.go
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,13 @@ import (
)

func (ctx *VmContext) loop() {
for ctx.handler != nil {
for {
ctx.lock.Lock()
handler := ctx.handler
ctx.lock.Unlock()
if handler == nil {
break
}
ev, ok := <-ctx.Hub
if !ok {
ctx.Log(ERROR, "hub chan has already been closed")
Expand All @@ -21,7 +27,7 @@ func (ctx *VmContext) loop() {
continue
}
ctx.Log(TRACE, "main event loop got message %d(%s)", ev.Event(), EventString(ev.Event()))
ctx.handler(ctx, ev)
handler(ctx, ev)
}

// Unless the ctx.Hub channel is drained, processes sending operations can
Expand Down