s://play.golang.org/p/fqPXXpNufO
>>
>> It ran for much longer before locking on the same line! Trouble is, now
>> I can't actually see the lock whereas I could before!
>>
>> I'm wondering if I should keep a global channelMap and lock that with
>> sync.R
Actually, a buffered channel alone is not enough...
A more robust solution is to move the shutdown branch in jobDispatcher into
a function; then call this function in a goroutine of its own right after
you create shutdown channel. That will prevent the message sending and
channel closing from d
Your deadlock happens because the message channel is not buffered. The
jobDispatcher goroutine is blocked waiting for channel to accept msg, while
the processPackets packets just sent the shutdown signal and exited (on the
time.Ticker branch of the select). A buffer of any size, even 1, would
a
Hi Fabian,
You could add a signal channel to tell your goroutine to exit. Editing your
pseudo code:
data := make(chan byte)
done := make(chan struct{})
fd := some file descriptor
go func() {
buf = make([]byte, 1)
for {
n, err = syscall.Read(fd, buf)
if err != nil {