Add thread

Will replace #28.

Waiting for https://github.com/cinemast/libjson-rpc-cpp/pull/56.