kidoman / embd

Embedded Programming Framework in Go
http://embd.kidoman.io
MIT License
1.28k stars 156 forks source link

fatal error: concurrent map read and map write #64

Closed gotang closed 8 years ago

gotang commented 8 years ago

call "Watch" method for a DigitalPin while another DigitalPin get an interrupt will cause "fatal error: concurrent map read and map write" error , beacause one write map (interruptablePins) and anthoer read this map.

Log: `fatal error: concurrent map read and map write

goroutine 18 [running]: runtime.throw(0x233cf7, 0x21) Go/src/runtime/panic.go:566 +0x78 fp=0x10618364 sp=0x10618358 runtime.mapaccess2_fast32(0x203100, 0x106c9880, 0xa, 0x40, 0xffffffff) Go/src/runtime/hashmap_fast.go:66 +0x5c fp=0x10618374 sp=0x10618364 github.com/kidoman/embd/host/generic.initEpollListener.func1(0x106e59b0) /src/github.com/kidoman/embd/host/generic/interrupt.go:65 +0x1b0 fp=0x106187d4 sp=0x10618374 runtime.goexit() Go/src/runtime/asm_arm.s:998 +0x4 fp=0x106187d4 sp=0x106187d4 created by github.com/kidoman/embd/host/generic.initEpollListener src/github.com/kidoman/embd/host/generic/interrupt.go:70 +0x194`

can you add an mutex here, thx.

tve commented 7 years ago

why did you close this issue?