Replace pthread with boost::thread

Boost thread is cross platform. Hopefully it becomes easier to port Caffe to Windows.