Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

Since the channels are unbuffered, theres no way to read from the error channel until the loop has accepted your request for the transaction. Also, since it won't accept another transaction request until it has sent an error (it always sends an error value), you always read the error for your transaction.

Any buffering in the request channels would have the race you've described though.



You're right. Thanks for explanation.


If unbufferred, is there any difference with mutex?

how about sending a errChan along with the delta to the deltaChan and and error will be guaranteed to be replied to the correct sender?




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: