Closed cpg closed 11 years ago
Although this is, arguably, a race condition, it does not perform unsafely. At this point the connection has been closed, so although it is uncertain whether Header() will return the connection's former header or nil, either is acceptable.
yes. i don't understand why it's even reported as a race, given that there is an s.Lock at the top and s.Unlock deferred.
The reason it reports a race is that Header() doesn't use a lock, so it can still happen at the same time as the write, but in this instance that is still safe.
here is an interesting race condition reported.