1
0
mirror of https://github.com/kidoman/embd synced 2024-12-22 21:00:05 +01:00

fix fatal error: concurrent map read and map write

This commit is contained in:
gotang 2016-08-20 14:10:49 +08:00
parent bfcd1345fe
commit 6021814731

View File

@ -61,11 +61,13 @@ func initEpollListener() *epollListener {
if err != nil { if err != nil {
panic(fmt.Sprintf("EpollWait error: %v", err)) panic(fmt.Sprintf("EpollWait error: %v", err))
} }
listener.mu.Lock()
for i := 0; i < n; i++ { for i := 0; i < n; i++ {
if irq, ok := listener.interruptablePins[int(epollEvents[i].Fd)]; ok { if irq, ok := listener.interruptablePins[int(epollEvents[i].Fd)]; ok {
irq.Signal() irq.Signal()
} }
} }
listener.mu.Unlock()
} }
}() }()
return listener return listener