You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
while looking on my problem with the interrupt signal capture I noticed that your code is slightly racy in embeddedProcess.Wait.
An embedded process can have multiple listeners on its Wait event, but the channel is wrote only once.
If multiple readers are competing to get the exit code/wait,
it is unknown as to who will enter the code := <-e.doneCh case and who will enter the <-ctx.Done(): case.
I guess you could use atomic.StoreInt, and close the channel rather than writing it (though don't read it, it would return the zero value). Because channels are somehow locked, i guess it is not needed to use atomic.LoadInt in replacement within the Wait method, a direct access should do fine.
The text was updated successfully, but these errors were encountered:
An embedded process can have multiple listeners on its Wait event, but the channel is wrote only once.
Ah yes, it wasn't really written for multiple waiters. I haven't worked on this project in a while, but would welcome a PR to support multiple waiters.
Hi,
while looking on my problem with the interrupt signal capture I noticed that your code is slightly racy in
embeddedProcess.Wait
.An embedded process can have multiple listeners on its
Wait
event, but the channel is wrote only once.If multiple readers are competing to get the exit code/wait,
it is unknown as to who will enter the
code := <-e.doneCh
case and who will enter the<-ctx.Done():
case.see https://github.com/cretz/bine/blob/master/process/embedded/tor-0.4.7/process.go#L69
I guess you could use atomic.StoreInt, and close the channel rather than writing it (though don't read it, it would return the zero value). Because channels are somehow locked, i guess it is not needed to use atomic.LoadInt in replacement within the Wait method, a direct access should do fine.
The text was updated successfully, but these errors were encountered: