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

Merge pull request #4 from gotang/master

fix fatal error: concurrent map read and map write
This commit is contained in:
Thorsten von Eicken 2016-09-05 23:36:21 -07:00 committed by GitHub
commit 49e6cc504d

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