Remove lock os thread in event loop
Signed-off-by: Michael Crosby <crosbymichael@gmail.com>
This commit is contained in:
parent
bdeb87a090
commit
34024a5dbc
1 changed files with 1 additions and 6 deletions
|
@ -1,9 +1,6 @@
|
||||||
package eventloop
|
package eventloop
|
||||||
|
|
||||||
import (
|
import "sync"
|
||||||
"runtime"
|
|
||||||
"sync"
|
|
||||||
)
|
|
||||||
|
|
||||||
// Event is receiving notification from loop with Handle() call.
|
// Event is receiving notification from loop with Handle() call.
|
||||||
type Event interface {
|
type Event interface {
|
||||||
|
@ -35,8 +32,6 @@ func NewChanLoop(q int) EventLoop {
|
||||||
// All calls after first is no-op.
|
// All calls after first is no-op.
|
||||||
func (el *ChanLoop) Start() error {
|
func (el *ChanLoop) Start() error {
|
||||||
go el.once.Do(func() {
|
go el.once.Do(func() {
|
||||||
// allocate whole OS thread, so nothing can get scheduled over eventloop
|
|
||||||
runtime.LockOSThread()
|
|
||||||
for ev := range el.events {
|
for ev := range el.events {
|
||||||
ev.Handle()
|
ev.Handle()
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue