Fixed compile errors.

Ringbuffer still doesn't compile; it isn't in CMakeLists.txt.
Actually properly moved threads.cpp