Fixed a memory leak issue in InternalThread (and removed caffe::Thread)

This PR fixes the memory leak issue I posted here:
https://github.com/BVLC/caffe/issues/1316#issuecomment-59581162