Added basic threading framework

Threading framework implemented (quick+dirty). Should be enough of a
basis to start implementing the statsd flusher and the mysql poller.