braintree / manners

A polite Go HTTP server that shuts down gracefully.
MIT License
997 stars 103 forks source link

remove race condition from tests from the "language level" #18

Closed kornel661 closed 9 years ago

kornel661 commented 10 years ago

Using channels instead of variables (and a bit of refactoring) removes race conditions from the "language level". There's still a race condition on the level of TCP connections.

It seems to me that this code is better in a sense that communication between goroutines doesn't involve reading and writing from the same variable concurrently.

lionelbarrow commented 10 years ago

I see, your problem was with unsynchronized access to the exited boolean, not the structure of the test itself. That makes more sense. I'll take a look at this tomorrow.