Psiphon-Labs/psiphon-tunnel-core — pull request #51 by rod-hynes (2014-12-29 20:36:50+00:00)
Title: Fix: processStats goro was pinning the CPU. Add flag to enable CPU profiling.

Fix: processStats goro was pinning the CPU. The problem was due to a 'default' select case which always ran. As this case was important to prevent callers to recordStat() from blocking forever, and a robust fix appeared complex, I have simply removed the processStats goro and associated channel. A buffered channel requires a mutex lock in any case [1], and the mutex-protected logic, now inline in recordStat, will execute in fractions of a microsecond. I believe that the goro/channel is not worth the extra complexity at this time.

[1] https://github.com/golang/go/issues/6394