An implementation of a thread safe shared ptr