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:
commit
49e6cc504d
@ -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
|
||||||
|
Loading…
x
Reference in New Issue
Block a user