diff --git a/event/resolve.go b/event/resolve.go index 102a64bf..3ea897ac 100644 --- a/event/resolve.go +++ b/event/resolve.go @@ -1,9 +1,5 @@ package event -import ( - "runtime" -) - // ResolvePending is a contant loop that tracks slices of bind or unbind calls // and resolves them individually such that they don't break the bus // Todo: this should be a function on the event bus itself, and should have a better name @@ -11,19 +7,8 @@ import ( // the answer is we tried, and it was cripplingly slow. func (eb *Bus) ResolvePending() { eb.init.Do(func() { - schedCt := 0 for { eb.Flush() - - // This is a tight loop that can cause a pseudo-deadlock - // by refusing to release control to the go scheduler. - // This code prevents this from happening. - // See https://github.com/golang/go/issues/10958 - schedCt++ - if schedCt > 1000 { - schedCt = 0 - runtime.Gosched() - } } }) } diff --git a/inputLoop.go b/inputLoop.go index e2859391..462de5b2 100644 --- a/inputLoop.go +++ b/inputLoop.go @@ -1,8 +1,6 @@ package oak import ( - "runtime" - "github.com/oakmound/oak/v2/event" "github.com/oakmound/oak/v2/dlog" @@ -31,7 +29,6 @@ func inputLoop() { // Standard input eventFn = windowControl.NextEvent } - schedCt := 0 for { switch e := eventFn().(type) { // We only currently respond to death lifecycle events. @@ -123,13 +120,5 @@ func inputLoop() { //dlog.Verb("Got size event", e) ChangeWindow(e.WidthPx, e.HeightPx) } - // This loop can be tight enough that the go scheduler never gets - // a chance to take control from this thread. This is a hack that - // solves that. - schedCt++ - if schedCt > 1000 { - schedCt = 0 - runtime.Gosched() - } } }